Sparki to Arduino over Serial

Hi,

I am new to Sparki and I trying to get it to communicate with an Arduino Uno. I have wired the two together through the headers so that RX -> TX, TX -> RX and GND -> GND. The code I am trying to use is as follows:

Duo:

[code]void setup(){
Serial.begin(9600);
}

void loop(){
Serial.println(1); //Send 1 to Rx Arduino
delay(10000);
}[/code]

Sparki:

#include <Sparki.h> // include the sparki library

#define beep_command B1001010
#define noBeep_command B0
#define moveForward_command B1000110
#define moveBackward_command B10101
#define moveLeft_command B1000100
#define moveRight_command B1000111
#define gripperOpen_command B1001
#define gripperClose_command B111
#define gripperStop_command B1
#define moveStop_command B10
#define onIR_command B11
#define offIR_command B100
#define clearLCD_command B101
#define updateLCD_command B110
#define moveUpLine_command B11101
#define lightRight_command B1000
#define lightCenter_command B11100
#define lightLeft_command B1010
#define edgeRight_command B1011
#define lineRight_command B1100
#define lineCenter_command B1101
#define lineLeft_command B1110
#define edgeLeft_command B1111
#define ping_command B10000
#define ping_single_command B10001
#define readIR_command B10010
#define initAccelerometer_command B10011
#define compass_command B10100
#define readMag_command B11110
#define magX_command B10110
#define magY_command B10111
#define magZ_command B11000
#define accelX_command B11001
#define accelY_command B11010
#define accelZ_command B11011

uint8_t code = 0;
char R_X = 0;
void setup(){
  sparki.clearLCD();
  sparki.updateLCD();
}

void loop()
{ 
   R_X = Serial.available(); 
   if(R_X > 0)
  {
   //val = Serial.parseInt();  //Reads integers as integer rather than ASCI. Anything else returns 0
   sparki.println("RX");
   sparki.updateLCD();
   R_X=0;
   delay(10000);
  }
  else
  {
    sparki.println("error");
    sparki.updateLCD();
    delay(10000);
  }
  //if(code==B1001010)
    //sparki.beep();
  //else if(code==B0) 
    //sparki.noBeep();
  //else 
  if(code==B1000110)
    sparki.moveForward();
  else if(code==B10101) 
    sparki.moveBackward();
  else if(code==B1000100)
    sparki.moveLeft();
  else if(code==B1000111) 
    sparki.moveRight();
  else if(code==B1001) 
    sparki.gripperOpen();
  else if(code==B111) 
    sparki.gripperClose();
  else if(code==B1) 
    sparki.gripperStop();
  else if(code==B10) 
    sparki.moveStop();
  else if(code==B11) 
    sparki.onIR();
  else if(code==B100) 
    sparki.offIR();
  else if(code==B101) 
    sparki.clearLCD();
  else if(code==B110) 
    sparki.updateLCD();
  else if(code==B11101) 
    sparki.moveUpLine();
  else if(code==B1000) 
    sparki.lightRight();
  else if(code==B11100) 
    sparki.lightCenter();
  else if(code==B1010) 
    sparki.lightLeft();
  else if(code==B1011) 
    sparki.edgeRight();
  else if(code==B1100) 
    sparki.lineRight();
  else if(code==B1101) 
    sparki.lineCenter();
  else if(code==B1110) 
    sparki.lineLeft();
  else if(code==B1111) 
    sparki.edgeLeft();
  else if(code==B10000) 
    sparki.ping();
  else if(code==B10001) 
    sparki.ping_single();
  else if(code==B10010) 
    sparki.readIR();
  else if(code==B10011) 
    sparki.initAccelerometer();
  else if(code==B10100) 
    sparki.compass();
  else if(code==B11110) 
    sparki.readMag();
  else if(code==B10110) 
    sparki.magX();
  else if(code==B10111) 
    sparki.magY();
  else if(code==B11000) 
    sparki.magZ();
  else if(code==B11001) 
    sparki.accelX();
  else if(code==B11010) 
    sparki.accelY();
  else if(code==B11011) 
    sparki.accelZ();
}

Thanks for any help you can offer!

Hello,

For Sparki, to use the external serial port, you must use Serial1 instead of Serial. Serial is for the USB serial port.