Asked — Edited

Serial Communication With Arduino

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:

#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


ARC Pro

Upgrade to ARC Pro

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.

#9  

Nice...the exact same thing is on my to do list! Good to see that I will be having a thread to look up if I am running into any issues!:)

#10  

Hi...i am a new user here. As per my knowledge you should go for a common ground even if you use full duplex lines. Also if you are using the same power source there is no need for a common ground.

surface mount assembly

#11  

Hi, 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?

void loop()                                           // execute the loop forever
{
  if(digitalRead(2)==LOW)                 // if button attached to the UNO is pressed
    {
     digitalWrite(3,HIGH);                         // turn ON the LED at PIN3
     Serial.println( "ButtonPressed" );        // send "ButtonPressed" string of characters serially out
     delay(200);                                           // wait for 200 milli second
     digitalWrite(3,LOW);                          // turn OFF the LED
    }
}

Source: arduino raspberry pi communication like arduino communicate with Raspberry pi

So please let me know if EZ-B has USB port?