Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- // initialize the digital pins as an output.
- pinMode(13, OUTPUT);
- // Turn the Serial Protocol ON
- Serial.begin(9600);
- }
- void loop() {
- byte byteRead;
- if (Serial.available()) {
- /* read the most recent byte */
- byteRead = Serial.read();
- //You have to subtract '0' from the read Byte to convert from text to a number.
- byteRead = byteRead - '0';
- Serial.print(F("byteRead = "));
- Serial.println(byteRead);
- int i,j;
- for ( i = 0; i < byteRead; i++) {
- for ( j = 0; j < 3; j++) {
- if (Serial.available()) {
- /* read the most recent byte */
- byteRead = Serial.read();
- //You have to subtract '0' from the read Byte to convert from text to a number.
- byteRead = byteRead - '0';
- Serial.print(i);
- Serial.print(':');
- Serial.print(j);
- Serial.print(F(":byteRead = "));
- Serial.println(byteRead);
- }
- }
- }
- }
- }
- for ( i = 0; i < byteRead; i++) {
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement