Go Down

Topic: RF modules can't send numbers with virutalWire (Read 3114 times) previous topic - next topic

Geek Ionizado

Thank you so much, I'm receiving data here, but now I have to work in how to put the numbers togheter to form a int number to flash a led

Geek Ionizado

Ok I tried SO MANY times, but I can't!

Look: I received data and transformed it to a String. Now I can't convert it to int to analogWrite and LED.
I tried like it too:
   for (i = 0; i < buflen; i++) {
       var = char(buf);
          int a = atoi(var);
       }
    }

But I can't :(

Could somebody help me?

Sorry by asking so many times, I'm not lazy, but I really got not results doing this, if somebody helps me I can understand, like the transmitter code...

:)

robtillaart

you must atoi the whole buffer at once ... assuming there is only one number in the buf

Code: [Select]

char buf[20] = "123";

void setup()
{
 Serial.begin(9600);
 Serial.print(atoi(buf));
}

loop()
{
}
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Geek Ionizado


Geek Ionizado

Here's the video: http://www.youtube.com/watch?v=XS-IoWyzJOQ :D

Thanks so much!

smeezekitty

PUT A RESISTOR ON THAT LED!
Atleast 100 ohms and 220-2.2K is recommended.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy