I have project which is called Color Sorter. We have to use the Intel Galileo as the main processor, the Python as the main programming language. We use the color sensor TCS 3200 to differentiate the color. I found out that using TCS 3200 will be effective with the Arduino UNO (because the frequencies of I/O pins on Galileo board are slow). So, i want to find a way to get the RGB value when sensing the color from the Arduino board and make it as the variable in the python script in Galileo. Could anyone show me the way to build a serial communication between 2 boards to carry out the above process. Thank you a lot! Sorry for my bad English.
How slow are the Galileo pins? I can't imagine they are slower than a 16MHZ Uno.
Now to answer your question, the Galileo has a UART on its Arduino header pins. Just use that. Or you can use SPI or I2C.
Yes, i have connected two GND terminals together of two boards, RX from Galileo to TX Arduino and TX from Galileo to RX Arduino. But, for example, i write a arduino sketch that contains a command (Serial.write(255)), then i write a python script that includes
import serial
ser = serial.Serial('/dev/ttyS0',9600)
a = ser.read()
print a
But it doesn't print the value 255 at all.
Post the simplest possible Arduino and Python codes that illustrate your problem - i.e complete programs, not snippets.
I presume the Python serial library is particular to the Galileo and can be assumed to work properly?
Have you any other way to test it ?
...R
For example, i write a arduino sketch for Uno that contains a command Serial.write(255), then i write a python script in Galileo that includes
import serial
ser = serial.Serial('/dev/ttyS0',9600)
a = ser.read()
print a
But it doesn't print anything. When i write Seria.write("255") or Serial.write("incoming")
The galileo prints 5 or g.
It seems to be printing the last character that it is sent.
WARNING: CONFUSING EXPLANATION
You could try something that waits for a < and starts reading. When it receives a > , it stops reading and puts the characters together. For example:
The Arduino send a message. The message is <.The Galileo reads the < and decides that there is a message coming.
Then, the Arduino sends a 2, 5, and another 5. To conclude the message, it send a >.
The Galileo appends the characters to a string as they come in.
When it gets the >, it converts the string to a number.
Code example:
import serial
ser = serial.Serial('/dev/ttyS0',9600)
messageStarted = False
string = ''
def getData():
a = ser.read()
if(a == '<'):
while(a != '>'):
a = ser.read()
string.append(a)
print(a)
getData()
on the Galileo. For the Arduino, I am not sure. You should be able to find out.
@dptntb17424315, if you want assistance please respond to Reply #3
...R