Go Down

Topic: (Help) Leonardo with SKXBEE for wireless transmission (Read 641 times) previous topic - next topic


I'm doing project on force sensing resistors and flex sensors with wireless communication using SKXBEE (Cytron)
I'm using Serial1 to send the output to Xbee, but I can't get any data from Leonardo, is the coding wrong? Need some help here~

int outputFSR = 0;       
int outputFlex = 0;
int SensorPins[] = {0,1,2,3,4,5,6,7,8,9};   // set the analog pins (connected to FSRs and Flex Sensor) into an array
int SensorCount = 10 ;                            // number of sensors on the insole
int sensorArray[] = {};                            // set the voltage values into an array

void setup()
  // initialize serial communications at 9600 bps:
  while (!Serial)
    ; // wait for serial port to connect. Needed for Leonardo only

void loop()
  // read the FSR analog values:
  for (int thisPin = 0; thisPin < SensorCount; thisPin++)
    if ( SensorPins[thisPin]==0||SensorPins[thisPin]==9)
          //for flex sensor only
      int FlexValue = analogRead(SensorPins[thisPin]);
      outputFlex = map(FlexValue, 700, 800, 0, 255);
      sensorArray[thisPin] = outputFlex;
      //for FSR values

      int FSRValue = analogRead(SensorPins[thisPin]);           
      // map it to the range of the 8-bit analog output:
      outputFSR = map(FSRValue, 0, 1023, 0, 255); 
      sensorArray[thisPin] = outputFSR;
      // store each sensor value into an array

  // Send the values to Xbee

  Serial1.print("Sensor ");
  Serial1.print(" = ");

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:



with wireless communication using SKXBEE (Cytron)

And this relates to XBee how?

A link to the device you are using, a diagram of how it is connected to the Arduino, and some information on how the device is configured (and what it is talking to) would be useful.
The art of getting good answers lies in asking good questions.


My project is basically getting data from Force sensing resistors and flex sensors from Analog inputs of Leonardo and send the data via Xbee to computer (Xbee Dongle)

I have tried using Arduino Uno but using Serial instead of Serial1 and it works, I can get data from Terminal of X-CTU software for Xbee,
but for my project I need more analog input as Leonardo offers.

but when I connected to Leonardo to Xbee, I could not get any data from my Xbee dongle (no data in from Terminal of X-CTU).
Do I really need to include Xbee library or include coding like:



My connection for Leonardo to Xbee (as attached photo)

Hope u can help me, thanks~~


problem solved, getting data from Xbee dongle
by omitting the code
while (!Serial)
    ; // wait for serial port to connect. Needed for Leonardo only

Go Up