
rbonari
USA
Asked
— Edited
@PTP
I have read over the tutorial on making plugins and it was very good and helpful. I am looking to do a plugin using the serial port on the ezb to communicate with an arduino type board to communicate back and forth with various sensors, lcd's, etc.
I was wonering if I could get your source code for the serial toolbox plugin to learn from regarding serial port communications with ezb, etc. I am also taking a course on c# but there is nothing like actual examples of code when it comes to communicating with hardware serial ports. Most all courses don't go into this type of coding. Thanks much....Rick.
All the serial commands for the ezb can be found in...
EZ_Builder.EZBManager.EZB[0].Uart
@DJ
Thanks much, that helps but there is nothing like having a completed and working example to look over and learn from. The serial toolbox covers alot more than what was included in your awesome tutorial on plugins...Rick.
@DJ
Also curious as to how the serial plugin handles the arduino side of things...Rick.
Only to give a little bit of context. Rick sent me an email requesting some help to integrate an Arduino with ARC.
I will start by saying that: Arduino is not EZ you can easily open the IDE, copy paste some code, compile, flash and run.
But if you need to dig in you will need to know C/C++ language, how the libraries work, board specific details, code optimization, troubleshooting without breakpoints, limited memory, limited resources, interrupts, timers etc, etc.
Hardware used:
Arduino:
Power = USB/Cable Pins 0 - RX - Grey wire 1 - TX - Purple wire 3 - Red wire 5 - Green wire 9 - Blue wire GND - Black wire 5V - Orange wire
RGB Led (Common Cathode)
Red Led - Red wire Green Led - Green wire Blue Led - Blue wire 5v - Orange wire
EZB
Power = 7.5v Power supply Uart 0 - RX - Purple wire Uart 0 - TX - Grey wire Uart 0 - GND - Black wire (Common Ground)
Arduino Code:
https://github.com/ppedro74/Arduino-SerialCommands
Please download the and install the arduino library.
i opened a ticket to publish the library via Arduino IDE tool, later you will be able to search and install automatically via Arduino IDE.
Compile and flash!
Note: When flashing an Arduino with a single Serial Port (Atmega328, Atmega168) disconnect the RX/TX cables (EZB side) to avoid interferences.
Test Arduino Code:
Open the Arduino Serial Console:
Blue Note: When sending serial commands the existent code expects the CR & LF to end a line
Red Note: 57600 bps is intentional ! All micro-controllers have different clocks, when working with serial communications both sides (RX / TX) agree on a specific BaudRate / Clock, unfortunately 115200 bps @ atmega328 is not 115200. So let's use 57600.
more here: https://arduino.stackexchange.com/questions/296/how-high-of-a-baud-rate-can-i-go-without-errors
The arduino code (relevant part)
accepts the following commands: READ_ANALOG, SET_LED, START_PUSH, STOP_PUSH
some examples:
The above commands are examples how:
After submitting the above commands:
Note: After the START_PUSH the arduino code starts pushing messages to the console. This can be modified to instruct the Arduino to perform some action or monitor a sensor and report the values back with a specific frequency or a specific trigger, all depends the code logic.
ARC Side
To be continued...