We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Heyy guys ! New arduino and proccesing user and ive recently created this buzzwire game on arduino. It works pretty much the same as a stopwatch. I would like to know if it is possible to save the times using processing and how to do it !So when a player hits the stopwatch and his time appears on the arduino serial monitor i want that time to be saved Here is my current arduino code
`````unsigned long start, finished, elapsed, bonus;
void setup() // run once, when the sketch starts { Serial.begin(9600); // set up Serial library at 9600 bps pinMode(2, INPUT); // start button pinMode(3, INPUT); // stop button pinMode(4,INPUT); // Wire touch
Serial.println("Press 1 for Start/reset, 2 for elapsed time"); }
void displayResult() //Fucntion converts elapsed time from miliseconds to minutes & seconds { float h, m, s, ms; unsigned long over; elapsed = finished - start; h = int(elapsed / 3600000); over = elapsed % 3600000; m = int(over / 60000); over = over % 60000;
ms = over % 1000; s = bonus + int(over / 1000); Serial.print("Raw elapsed time: "); Serial.println(elapsed); Serial.print("Elapsed time: "); Serial.print(h, 0); Serial.print("h "); Serial.print(m, 0); Serial.print("m "); Serial.print(s, 0); Serial.print("s "); Serial.print(ms, 0); Serial.println("ms"); Serial.println(); }
void loop() { if (digitalRead(2) == HIGH) { start = millis(); delay(500); // for debounce Serial.println("Started..."); }
if (digitalRead(4) == HIGH) { bonus += 1000; delay(500); // for debounce Serial.println("TOUCH"); }
if (digitalRead(3) == HIGH) { finished = millis(); delay(500); // for debounce displayResult(); } }````
Answers
Look at it
saveStrings