Show Posts
Pages: [1] 2 3 ... 7
1  Using Arduino / Networking, Protocols, and Devices / Re: XBee Series 2 with Arduino + Accelerometer on: July 04, 2013, 07:20:48 pm
The accelerometer is transmitting data to the Arduino's serial port, which in turn is transmitting it through the XBees.  I'm using two official Xbee shields from Arduino (wireless proto and wireless SD).  

I would like to know how to transmit 2 pieces of data through XBees, and then filter the results on the other side so that the data is usable for the FuzzBot.  Thanks!
2  Using Arduino / Networking, Protocols, and Devices / XBee Series 2 with Arduino + Accelerometer on: July 03, 2013, 12:04:52 pm
Hi All,

About two months ago, I posted the FuzzBot Instructable, and wanted to have more options for the user, other than cleaning their house.  I decided to use Xbee Series 2 Zigbee modems, one in Coordinator AT mode, the other in Router AT.  I'm using the ADXL362 Breakout from SparkFun (https://www.sparkfun.com/products/11446), and the ADXL362 Library from Github by annem, which I modified (https://github.com/Qtechknow/ADXL362) with an Arduino UNO.  I have all of the code up and running for the transmitter side (Coordinator AT + Arduino + Accelerometer).  In the library, I modified it so that it automatically uses the map function to shield the values of the accelerometer from about -1500 to 1500 to -400 to 400, so that the receiver would just write that value to the motors on the FuzzBot.  Here is the code for the transmitter (which currently works):
Code:
/*  TiltBot Transmitter

Code for ADXL362 with an Arduino and XBee to transmit to the FuzzBot, giving
the user of this code control of the FuzzBot.

created by Quin (Qtechknow
made on 01 July 13
*/

#include <SPI.h>
#include <ADXL362.h>


ADXL362 xl;

int temp;
int XValue, YValue, ZValue, Temperature;


void setup(){
    Serial.begin(9600);
    xl.begin();             // Setup SPI protocol, issue device soft reset
    xl.beginMeasure();      // Switch ADXL362 to measure mode  
}

void loop(){
    
    // read the data of X and Y, formatted into -400, 400 for FuzzBot Motors
    Serial.print(" ");
    xl.readXData();
    Serial.print(" ");
    xl.readYData();
    delay(100);  // delay so that it doesn't go too fast
}

Here is the code for the receiver, that currently doesn't work.  I'm not sure what data form it should be in (int, char, byte) for the actual values.  The Serial readings will be a space, then x value, then another space, and then the y value over and over.

Code:
/* FuzzBot

Code for the ZumoBot, with Ping Sensor on Servo to do obstacle avoidance.

posted on Instructables

created 15 Apr 13
made by Quin (Qtechknow)
*/

#include <Ping.h>
#include <ZumoMotors.h>

Ping ping = Ping(4);

ZumoMotors motors;
 
void setup() {      
  Serial.begin(9600);    // start serial communication at 9600 baud
}
 
 
void loop()
{
   if(Serial.available()) {
     byte discarD = Serial.read();
     x = Serial.read();
     byte discard = Serial.read();
     double y = Serial.read();
     Serial.print(x);
   Serial.print(" ");
   Serial.print(y);
   Serial.print(" ");
   }
}

The above code outputs either -1, 0, or inbetween 45 and 55 on the Serial monitor for some reason.  It doesn't output the accelerometer data.

The below code, if I upload it to the receiver, it will output the exact accelerometer data.

Code:
void setup() {
  Serial.begin(9600);
}

void loop() {
  if(Serial.available()) {
  char a = Serial.read();
  Serial.print(a);
  }
}    

Any help?


Thanks!
Quin
3  Using Arduino / Programming Questions / Leonardo not Showing up in Serial Ports on: April 12, 2013, 08:57:24 am
Hi All,

I was running into some issues with the Arduino Leonardo when I was making this project.  I just bought the Arduino Touch Shield (https://www.sparkfun.com/products/10508) from SparkFun, and it is awesome!  Since I have a laptop that doesn't have the extra # keypad on the right side, I decided that I would make one.  I planned on using the Touch Shield as well as the Arduino Leonardo (because of the keyboard emulation function, which is so cool!), but I ran into some problems.

I tried to upload the code to the UNO first, because I believe that it's a little more consistent running programs than the Leonardo, since the UNO has been around for a little while longer.  I uploaded the example sketch from the Touch Shield page on SparkFun, and it worked perfectly fine.  The touch shield worked, and it printed out what numbers I pressed on the Serial monitor.

I then tried it with the Arduino Leonardo, which worked with uploading the code.  However, I couldn't open the Serial monitor.  My Arduino was definitely plugged into my computer.  When I looked at the available ports in Arduino (and also CoolTerm, a terminal program for Mac), my Arduino's Serial Port was gone (I'm on a Mac, so it's always something like /dev/tty.usbmodemfd131, and noticeable).  However, when I reset the Leonardo, it fades the D13 LED (I think that's how the board resets), and I can see the port on my screen.  I quickly try to open the Serial monitor, it opens, but it doesn't print anything out.  Then, it just goes back to the "where's the serial port?" loop again.  I've also tried to bootload the Arduino again, but it didn't work after that.

Any Help???

Thanks in advance,
Quin
4  Using Arduino / Project Guidance / Touch Shield Project on: April 11, 2013, 07:59:47 pm
Hi All,

I was running into some issues with the Arduino Leonardo when I was making this project.  I just bought the Arduino Touch Shield (https://www.sparkfun.com/products/10508) from SparkFun, and it is awesome!  Since I have a laptop that doesn't have the extra # keypad on the right side, I decided that I would make one.  I planned on using the Touch Shield as well as the Arduino Leonardo (because of the keyboard emulation function, which is so cool!), but I ran into some problems.

I tried to upload the code to the UNO first, because I believe that it's a little more consistent running programs than the Leonardo, since the UNO has been around for a little while longer.  I uploaded the example sketch from the Touch Shield page on SparkFun, and it worked perfectly fine.  The touch shield worked, and it printed out what numbers I pressed on the Serial monitor.

I then tried it with the Arduino Leonardo, which worked with uploading the code.  However, I couldn't open the Serial monitor.  My Arduino was definitely plugged into my computer.  When I looked at the available ports in Arduino (and also CoolTerm, a terminal program for Mac), my Arduino's Serial Port was gone (I'm on a Mac, so it's always something like /dev/tty.usbmodemfd131, and noticeable).  However, when I reset the Leonardo, it fades the D13 LED (I think that's how the board resets), and I can see the port on my screen.  I quickly try to open the Serial monitor, it opens, but it doesn't print anything out.  Then, it just goes back to the "where's the serial port?" loop again.  I've also tried to bootload the Arduino again, but it didn't work after that.

Any Help???

Thanks in advance,
Quin
5  Topics / Product Design / Re: Package of Hex Converter on: July 31, 2012, 03:37:53 pm
Thanks!
6  Topics / Product Design / Re: Inductors on: July 31, 2012, 02:00:11 pm
Ok.  Thanks!  I'm going to solder the first few boards by hand (will be pretty hard), then go with solder stenciling.
7  Topics / Product Design / Package of Hex Converter on: July 31, 2012, 01:59:08 pm
Hi All,

I was just creating a board based on the microSD shield from Sparkfun https://www.sparkfun.com/products/9802, and wanted to use the hex converter with the micro sd card slot.  When I originally found the part in eagle, it had no package whatsoever named.  Any help with the correct package?

Thanks,
Qtechknow
8  Topics / Product Design / Re: Inductors on: July 31, 2012, 01:46:58 pm
I'm using it in the same way that SparkFun is, so I think that it's alright with 4.7uH/1.62A.  Am I wrong?

Thanks!
9  Topics / Product Design / Re: Inductors on: July 31, 2012, 01:30:18 pm
Thanks.  Do you think that 4.7uH, 1.62A is okay when SparkFun uses 4.7uH, 1.2A?
10  Topics / Product Design / Re: Inductors on: July 31, 2012, 01:19:42 pm
Thanks.  Do you know if they carry CDRH3D28 packages of them???
11  Topics / Product Design / Re: Inductors on: July 31, 2012, 01:01:49 pm
Thanks.  Do you know which part that I should get from Mouser/Digikey?
12  Topics / Product Design / Inductors on: July 31, 2012, 12:52:46 pm
Hi All,

I'm not sure what an inductor is, and what it does.  I copied part of a schematic (http://www.sparkfun.com/datasheets/Prototyping/LiPower-v11.pdf) to go into a development board that I have.  The part number of the inductor is CDRH3D28, and I can't find the component on Digikey.  The value that I'm suppose to find is 4.7uH, 1.2A.  The products that I find are 4.7uH, 1.68A, and 10uH, 1.18A.  Any help on which part I should get (or a different part on Mouser)?

Thanks,
Qtechknow
13  Using Arduino / Programming Questions / Re: Small Error Message in long line of code on: July 16, 2012, 02:56:33 pm
Perfect!  Works Great!  Thanks
14  Using Arduino / Programming Questions / Re: Small Error Message in long line of code on: July 16, 2012, 02:54:01 pm
Thanks for the help.  I do know what a for loop is, but I don't really want to use a for loop for this project.  I would rather make the code how I know it works (with ifs), than a way that I've only been using for a few months. 

Any Help?
15  Using Arduino / Programming Questions / Small Error Message in long line of code on: July 16, 2012, 02:49:33 pm
Hi all,
I just was making a small project that takes multiple readings of one sensor per second, and ran into an error message that I can't figure out.

In the IDE, when I compile, this line of code becomes yellow:
Code:
        if(sample3 <= 200 || sample31 <= 200 || sample32 <= 200 || sample33 <= 200 || sample34 <= 200 || sample35 <= 200 || sample36 <= 200 || sample37 <= 200 || sample38 <= 200 || sample39 <= 200 || sample301 <= 200 || sample302 <= 200 || sample303 <= 200 || sample304 <= 200 || sample305 <= || sample306 <= 200) {

Yep, somehow I fit all of that into one line of code.

And I get this error message:
Code:
SodaMachine.cpp: In function 'void loop()':
SodaMachine:156: error: expected primary-expression before '||' token

Any Help?

Thanks,
Qtechknow
Pages: [1] 2 3 ... 7