Receive data from Arduino UNO R3


hello:

arduino uno r3 connect via usb. have simple fact input code works.
code: [select]
byte datos;

void setup()
{
       serial.begin(9600);    
}

void loop() {
             if (serial.available())
             {
                 datos = serial.read();
                 if (datos == 'a')
                 {
                   serial.println("vida: ha llegado variable a: ");
                 }
                 
                 if (datos == 'b')
                 {
                   serial.println("balas: ha llegado variable b: ");
                 }
                 
                 if (datos == 'c')
                 {
                   serial.println("mana: ha llegado variable c: ");
                 }
               }
               
               delay(100);
            }


i intend connect 16x2 lcd display i'll settle view data in "serial monitor" in arduino ide 1.0.5.

i made small application in c # send data arduino. 3 variables. distinguish each, first send byte 'a', behind him decimal numeric values ??shown thereupon send 'b' other numerical data execute code in b above , same 'c' .

if send secuantia c #:
quote
a100b10c100


in serial monitor shows this:
quote
vida: ha llegado variable a:
balas: ha llegado variable b:
mana: ha llegado variable c:


should appear:
quote
vida: ha llegado variable a:
vida: 100
balas: ha llegado variable b:
balas: 10
mana: ha llegado variable c:
mana: 100


how capture data in each corresponding numbers if?

i hope have explained well.

a greeting.

code: [select]
if (datos == 'a')
                  {
                    serial.println("vida: ha llegado variable a: ");
                  }


add serial prints print variable:

code: [select]
if (datos == 'a')
                  {
                    serial.println("vida: ha llegado variable a: ");
                    serial.println("vida: ");
                    serial.print(datos);
                  }


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Receive data from Arduino UNO R3


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support