Pages: [1]   Go Down
Author Topic: How to pass Multi_byte values between two Arduinos  (Read 701 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Using one Arduino connected with a potentiometer, and the other one connected with an LED, read pin(A0) to get the analog result and pass the Multi-byte values to Arduino_B to control the brightness, how to do this?

Thanks!
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26632
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming that the LED is on a PWM pin, then there's no need to pass multibyte values - the PWM value will be a single byte.

Are you asking how you would physically connect the two boards, or how to pick apart an "int" and re-assemble it at the receiver?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

how to pick apart an "int" and re-assemble it at the receiver
Logged

Boston
Offline Offline
Full Member
***
Karma: 0
Posts: 101
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could use a union on each side.  Convert the int to a byte array on the send side, then convert that array back on the receive side.

This post (and the replies that follow) should get you there.  They're converting floats, but it will work with ints as well.  http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207242838

-Brett
Logged

Pages: [1]   Go Up
Jump to: