Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char myChar;
- String content = "";
- char character;
- int motorControl = 1; //not really implimented yet
- int yCord = 0;
- int xCord = 0;
- char xCordLength;
- char yCordLength;
- int xCordLengthInt = 0;
- int yCordLengthInt = 0;
- void setup()
- {
- pinMode(5, OUTPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- while(Serial.available()) {
- character = Serial.read();
- content.concat(character);
- }
- // myChar = Serial.read();
- if (character == 'c') // first varible saying to connect
- {
- Serial.write('4'); // just saying it's connected
- }
- else if (character == 'x' && motorControl == 1)
- {
- Serial.write('3');// saying it's ready for new input
- }
- if (character = 'x' && motorControl ==1) {
- xCordLenght = Serial.read();
- delay(20);
- xCordLengthInt = xCordLength.toInt();
- xCord = Serial.read(xCordLengthInt);
- while(Serial.available()) {
- character = Serial.read();
- content.concat(character);
- }
- }
- if (character && motorControl ==1) {
- Serial.write('4');
- }
- yCordLenght = Serial.read();
- delay(20);
- yCordLengthInt = yCordLength.toInt();
- yCord = Serial.read(yCordLengthInt);
- character = 0;
- content = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement