Pages: 1 [2]   Go Down
Author Topic: RF modules can't send numbers with virutalWire  (Read 1953 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad

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...

smiley
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
char buf[20] = "123";

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

loop()
{
}
Logged

Rob Tillaart

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

0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I did it!

smiley-grin:D

Thanks to everyone!

Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's the video: smiley-grin

Thanks so much!
Logged

Washington
Offline Offline
God Member
*****
Karma: 30
Posts: 779
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PUT A RESISTOR ON THAT LED!
Atleast 100 ohms and 220-2.2K is recommended.
Logged

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!

Pages: 1 [2]   Go Up
Jump to: