Untitled
unknown
plain_text
13 days ago
746 B
2
Indexable
const int numberOfStations = 3; char inputLine[64]; int currentPosition = 0; int reading = false; void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: while(Serial.available()){ char letter = Serial.read(); if (letter == 'S'){ currentPosition = 0; inputLine[currentPosition++] = letter; reading = true; } else if(reading){ if(letter == 'X'){ inputLine[currentPosition] = letter; reading = false; for(int i = 0; i <= currentPosition; i++){ Serial.print(inputLine[i]); } Serial.println(); } else inputLine[currentPosition++] = letter; } } }
Editor is loading...
Leave a Comment