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...
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.
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 EZ-Builder.
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.
1) Arduino UNO
2) EZB V4
Power = USB/Cable
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
Power = 7.5v Power supply
Uart 0 - RX - Purple wire
Uart 0 - TX - Grey wire
Uart 0 - GND - Black wire (Common Ground)
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.
The arduino code (relevant part)
SerialCommand cmd_read_analog_("READ_ANALOG", cmd_read_analog);
SerialCommand cmd_set_led_("SET_LED", cmd_set_led);
SerialCommand cmd_start_push_("START_PUSH", cmd_start_push);
SerialCommand cmd_stop_push_("STOP_PUSH", cmd_stop_push);
accepts the following commands: READ_ANALOG, SET_LED, START_PUSH, STOP_PUSH
//reads analog port 0
//read analog port 1
//read analog port 2
//set red led (ON) RGB Led (Common Cathod/255-Off, 0-ON)
SET_LED 0 red
//set red and green led (OFF)
SET_LED 255 red green
//set red and blue led (HALF bright)
SET_LED 128 red blue
//request ping push messages every 1000 ms
START_PUSH 0 1000
//request analog push messages every 3000 ms
START_PUSH 1 3000
//stop ping push messages
//stop analog push messages
The above commands are examples how:
1) Set actions (SET_LED) (Note: multiple parameters example)
2) Read Values (READ_ANALOG)
3) Monitoring values / Pushing results (START_PUSH / STOP_PUSH)
After submitting the above commands:
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.
To be continued...