Calculon has been tinkering with his Arduino for a few months now and he likes it. He is at the point where he is trying to get his 'duino to communicate with another device. His question is: HOW?!?!?
1. Does he use the Serial.print command? Serial.write?
2. How does he send more than one byte at a tyme?
3. Here's an example of the required byte sequence:
in hex: 0x8D, 0x7F
in decimal: 141, 127
Does he just send one byte, and then another?
4. Can he communicate with another device using SoftwareSerial while using the UART to talk to the Serial Monitor? Or is it one or the other?
5. Can he communicate with the device using the hardware RX and TX pins (0 and 1) while plugged in to the pc?
6. A side-note: please don't just direct me to the SoftwareSerial documentation page. Calculon has read it and is even more confused.
You are all very capable persons.
He writes Serial.print(0x8D);. He sends more than one byte typing it between parentheses. If he wants to communicate with other device with hardware serial he must connect tx-rx.
edit: Damn, i didn’t noticed you are using software serial. I mean, he is using.
1- Serial.print, cause write
1- Serial.print, cause write is for binary only.
2- Don’t know. In the examples i’ve seen they always send one variable at a time
4- serial monitor receives data from the TX (pin1) only. You could either try to connect the pin you are using to the TX pin (not really to TX pin actually, but to what the TX is connected, and maybe add a diode so that the current does not end up in the TX pin), or use the normal Serial command after using SoftwareSerial.
5- yes, but i don’t know if you can do that with the arduino software. You CAN do this for sure with processing, visual basic,…
EDIT: yes you can also use the arduino software, i just checked!
6- ok :=)
hope this helps!
PS: i personally like the “serial” command more than softwareserial. If
you he only needs to communicate to one device (or to multiple devices but send them the same command) i suggest you use the RX and TX pins. If you use them you will also automatically send your data to arduino’s serial monitor on the pc. Plus it has a buffer, and that is quite cool!