Hey everyone,
I am using arduino's in my coding class, and have tried to communicate with it via the ez-b over serial. I seem to be able to receive, but I am not able to send it seems.
I am using the serial terminal for ez-b, as well as the serial monitor in the arduino ide. When I send a string, the ez-b recieves, but I cannot seem to get the arduino to recieve from the ez-b.
I was wondering if anyone who has been doing this can shed some light on it for me, as I am still trying to learn the ropes.
Arduino code:Code:
#include
Servo servo1; servo servo2;
void setup() {
pinMode(1,OUTPUT);
servo1.attach(14); //analog pin 0
//servo1.setMaximumPulse(2000);
//servo1.setMinimumPulse(700);
servo2.attach(15); //analog pin 1
Serial.begin(9600);
Serial.println("Ready");
}
void loop() {
static int v = 0;
if ( Serial.available()) {
char ch = Serial.read();
Serial.println("y");
switch(ch) {
case '0'...'9':
v = v * 10 + ch - '0';
break;
case 's':
servo1.write(v);
v = 0;
break;
case 'w':
servo2.write(v);
v = 0;
break;
case 'd':
servo2.detach();
break;
case 'a':
servo2.attach(15);
break;
}
}
}
Thanks guys.
Dylan
Asked
— Edited
Did you configured the serial monitor with no "line ending" window bottom right ?
Are you sure the wire is connected to the correct port?
If it receives, it is sending. Check the wiring
Your code looks fine, although i'd add a DEFAULT for debugging...
Code:
bear in mind if you are using the same power source there is no need for a common ground.
I would say there is no reason not work...
"the devil is in the details"
Please provide more details:
1) Are you using EZB or IoTiny ? EZB this one is simple
2) Arduino model
3) Wiring
4) Arduino's Serial console print screen.
5) ARC side print screen.
https://www.arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf
Uno has only one serial port: Pins 0 and 1 and is shared with another micro-controller (atmega16u2) to handle the USB communication.
When you connect to your arduino to monitor the communication the usb controller takes control over the serial port and if both pins are connected to the EZB you may have a problem.
You should use only the ARC serial monitor.
if you want to use the arduino usb/serial console or during arduino firmware uploads you need to disconnect any wires on pins 0 & 1, special the pin 0 (RX).
Arduino Uno:
use SoftwareSerial library to implement a software serial port:
https://www.arduino.cc/en/Reference/softwareSerial and use those pins to communicate with EZB, keep the hardware serial for firmware uploads and debug serial console
Or use another arduino:
1) Arduino Leonardo has 2, USB + 1
2) Arduino Mega has 4: USB + 3
3) Teensy 3.2 Cortex M4 (Supports Arduino Ide) has 3
surface mount assembly
I am new in RObotics, and much interested in buying EZ-B Wi Fi robot controller. I have also faced difficulties in serial communication of Arduino with other boards. So if EZ-B has USB port, it will very easy to send data to USB over serial communication, we just need to send the data using Serial.println and nothing else. So does EX-b has USB port?
Code:
Source: arduino raspberry pi communication
like arduino communicate with Raspberry pi
So please let me know if EZ-B has USB port?