我无法将连续输出数据发送到Ms.Excel表。 我在32位系统中使用Proteus 8专业软件,Arduino 1.8.5 IDE和windos 7 OS。有人可以指导我发送数据。
这是我的Ardunio代码:
int incomingByte = 0;
unsigned long time;
unsigned long day = 86400000; // 86400000 milliseconds in a day
unsigned long hour = 3600000; // 3600000 milliseconds in an hour
unsigned long minute = 60000; // 60000 milliseconds in a minute
unsigned long second = 1000; // 1000 milliseconds in a second
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
if (Serial.available() > 0)
{
incomingByte = Serial.read(); // read the incoming byte:
Serial.print("Time: ");
time = millis();
int days = time / day ; //number of days
int hours = (time % day) / hour; //the remainder from
days division (in milliseconds) divided by hours, this gives the full hours
int minutes = ((time % day) % hour) / minute ; //and so on...
int seconds = (((time % day) % hour) % minute) / second;
Serial.print(days,DEC);
Serial.println(hours);
Serial.println(minutes);
Serial.println(seconds);
delay(1000);
}
}