Skip to content

Instantly share code, notes, and snippets.

Created March 13, 2013 18:44
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/5154933 to your computer and use it in GitHub Desktop.
Nokia Experiment2
#define BUFFERSIZE 127
uint8_t inBuffer[BUFFERSIZE];
int inLength; // length of data in the buffer
int numLoop = 0; // number of times we looped
int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
// read string if available
if (Serial.available()) {
inLength = 0;
while (Serial.available()) {
inBuffer[ inLength] = Serial.read();
inLength++;
if (inLength >= BUFFERSIZE)
break;
}
Serial.print("I received: ");
Serial.write(inBuffer ,inLength);
Serial.println();
}
// blink the led and send a number
digitalWrite(ledPin, HIGH); // set the LED on
delay(10); // wait a bit
Serial.println(numLoop);
digitalWrite(ledPin, LOW); // set the LED off
delay(1000);
numLoop++;
}
@AsadAlihp
Copy link

Thanks man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment