Show Posts
Pages: [1] 2 3 4
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino RF link ... sending a 10-bit value on: April 22, 2008, 11:58:56 am
Awesome. Thank you so much. I got it to work. It works great! I'm now seeing 0-1023 at the receiving end.

  I will definitely have to do some reading on C. Thanks for the snippet of info.


Thanks again!
Phil
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino RF link ... sending a 10-bit value on: April 22, 2008, 10:48:19 am
  Thanks a lot simond. I posted the same question on Ladyada's forums. Someone replied with a similar solution:

int  val;           // This is a 16 bit value
byte msb;           // 8 bit variable to hold the most significant byte
byte lsb;           // 8 bit variable to hold the least significant byte

loop() {
     //  some code
     //  goes
     //  here

  val = somedata;

  lsb = (byte)(val & 0xff);
  msb = (byte)(val >> smiley-cool;

  Serial.print(msb);
  Serial.print(lsb);
     //  more code
     //  goes
     //  here
}


   This all looks like it should work. I'm still trying to decipher it thought .... not sure what all the signs are actually doing ...  >>  ,  <<  ,  &  ,  0xff  , 0x03 , |



thanks a lot,
Phil
3  Forum 2005-2010 (read only) / Syntax & Programs / Arduino RF link ... sending a 10-bit value on: April 20, 2008, 12:21:37 pm
 Hello everyone. This is my 1st post on the forums. I've been tinkering around with Arduino programming for the last few months. I'm kinda stumped right now.

    I'm trying to send a 10-bit integer to a second arduino via wireless serial communication. So far I am only able to send an 8-bit integer.

   I know the problem is that I'm only sending one BYTE at a time ... and would really need to chop up the 10-bit number into 2 BYTES and then transmit ... but I can't seem to find/think of a way to do it.

  ...The 10-bit # is from a pressure sensor that is hooked up to the TX arduino via analog input. I'm using the Parallax 900MHz transceiver modules RFD21131  ... quite happy with them. Very easy to use & stable.

Here is my TX Code:

#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3

int potPin = 2;       //Goes to the pressure sensor
int val = 0;            // variable to store the value coming from the sensor
int valone = 0;      //using this to create an average of values...
int valtwo = 0;
int valthree = 0;
int valfour = 0;
int valfive = 0;
int valsum = 0;
int valaverage = 0;   //  ...  keep the output from fluctuating
int PreVal = 0;

SoftwareSerial rfSerial = SoftwareSerial(rxPin, txPin);   //using softwareserial

void setup() {
    
  rfSerial.begin(9600);       //initialize softwareserial
  Serial.begin(9600);         // begin serial communication over USB to the computer for debugging purposes
}
void loop(){
      val = analogRead(potPin);    // read the value from the sensor
      valone = val;                      //Taking average of 5 reading from analog in
      val = analogRead(potPin);
      valtwo = val;
      val = analogRead(potPin);
      valthree = val;
      val = analogRead(potPin);
      valfour = val;
      val = analogRead(potPin);
      valfive = val;
      valsum = valone + valtwo + valthree + valfour + valfive;
      valaverage = valsum/5;     // Average
      val = valaverage/4;           //********Change from 10-Bit # to 8-Bit # ***********
      
      if(val != PreVal){              // Prevents TX from constantly transmitting .. only want to TX when value changes
      Serial.print(val);               // send data to computer
      rfSerial.print(val, BYTE);    // send data out tx
      PreVal = val;
      delay(500);
  }
}

------------END OF TX CODE-------------------

RX CODE:

#include <SoftwareSerial.h>
#undef int()                                 //required for version 11 Arduino
#include <Stdio.h>                      
#include <LCD4Bit_mod.h>          //Bought a nifty LCD Sheild on Ebay .. uses a modified LCD 4-Bit library
#define rxPin 2
#define txPin 3
SoftwareSerial rfSerial =  SoftwareSerial(rxPin, txPin);
int val = 0;
char buf[6];                                 //Using this to properly display on LCD
char string1[] = "   ";                   // White space on LCD

LCD4Bit_mod lcd = LCD4Bit_mod(2);   //Using a 16X2 LCD

void setup() {
  lcd.init();
  lcd.clear();
  pinMode(rxPin, INPUT);              // set up pin for serial comm. with RF receiver
  rfSerial.begin(9600);                 // begin serial connection with RF Link unit
  Serial.begin(9600);                   // begin serial communication over USB to the computer  
}
void loop(){
  
                val = rfSerial.read();           //Read a Byte?? from the RX
                Serial.print(val, DEC);         // send data to computer in Decimal
                lcd.printIn(string1);             //White space on LCD
                lcd.cursorTo(1, 0);              //Moves cursor on LCD to line 1, position zero
                lcd.printIn(itoa(val, buf, 10));  //converts val into a string i think?
                delay(100);
                lcd.cursorTo(1, 0);            
              
            
      }

---------END OF RX CODE---------------------------------------------

  This all works great ... except I'm not able to send a 10-Bit value.

 I would greatly appreciate it if you guys & gals could give me some insight on the problem. I can see there are a lot of very bright people here.



thanks,
Phil

4  Forum 2005-2010 (read only) / Interfacing / Re: Serial data to Visual Basic, Visual C++, Java on: May 07, 2008, 05:00:44 am
  Thanks auerlg.

   I'm messing around with Processing right now ... not as easy as I initially thought it would be. I figured out last night how to print my data to a window using text();   ... still trying to figure out how to refresh it without overlapping the previous value.

  I guess I should still look into using VB. Is that code for the 2 way chat program? If so ... how easy would it be for me to use this for one-way communication (Arduino to VB) ?


thanks,
Phil
5  Forum 2005-2010 (read only) / Interfacing / Re: Serial data to Visual Basic, Visual C++, Java on: May 05, 2008, 04:07:25 pm
  Cool


thanks,
Phil
6  Forum 2005-2010 (read only) / Interfacing / Re: Serial data to Visual Basic, Visual C++, Java on: May 01, 2008, 03:10:08 pm
  Hello MikMo,

  Please do post the code. I would like to see it.


thanks,
Phil
7  Forum 2005-2010 (read only) / Interfacing / Re: Serial data to Visual Basic, Visual C++, Java on: May 01, 2008, 07:01:13 am
 Yeah ... I don't know why people complain about VB. I don't care about performance differences. It's not like I'm programming a 3D shooter or anything. Besides... I was reading that most programmers aren't even good enough to code in C++ to make it any faster than if it were in VB. I definitely know that I'm not good enough.

I'm more of a hardware guy than a programmer. I would just like to make some quick and easy windows apps that are functional.



Phil
8  Forum 2005-2010 (read only) / Interfacing / Re: Serial data to Visual Basic, Visual C++, Java on: April 30, 2008, 07:44:29 am
   Thanks guys for the help. I think for now I'm going to start with Processing. It seems to be a lot easier to work with. I would like to play around with some VB & C++ , but I don't think I'm ready for it at the moment.

  Thanks for the code Plastbox. That was very helpful. The only thing is ... I don't have VB 6.0 .. I have the free VB 2008 Express. I don't think it has MS Comm. It does have SerialPort.



thanks,
Phil
9  Forum 2005-2010 (read only) / Interfacing / Serial data to Visual Basic, Visual C++, Java on: April 26, 2008, 08:38:14 am
  Hello all,

   I'm interested in sending serial data from an arduino to my PC and have it displayed on either VB,VC++ or Java program. I'm not sure which one would be easiest to do. I would like to be able to make a simple program rather quickly ... nothing too fancy.
I just need to display a reading from one sensor.
 

thanks,
Phil
10  Forum 2005-2010 (read only) / Troubleshooting / Re: Sanguino Atmega 644p 16MHz Crystal 100nf caps on: October 10, 2010, 04:05:51 pm
  Got my new caps in today an used AVRStudio 4 to set the fuses for an external Crystal. Works great now. Thanks.
11  Forum 2005-2010 (read only) / Troubleshooting / Re: Sanguino Atmega 644p 16MHz Crystal 100nf caps on: October 06, 2010, 03:43:47 am
  Thanks. I will try this asap.




Phil
12  Forum 2005-2010 (read only) / Troubleshooting / Re: Sanguino Atmega 644p 16MHz Crystal 100nf caps on: October 05, 2010, 07:43:35 pm
  I haven't used avrdude at all to change fuses ... not really sure how.

Would it be necessary to change the fuses on a fresh chip purchased from Mouser?

  I ordered some 22pf caps. Will try it out as soon as I get them.



thanks,
Phil
13  Forum 2005-2010 (read only) / Troubleshooting / Sanguino Atmega 644p 16MHz Crystal 100nf caps on: October 05, 2010, 09:14:46 am
hey guys & gals,

   I have a slight problem here. Last night I soldered together my own Sanguino board. I went with a real bare bones design. I'm using my authentic Atmel avrispmkii USB ICSP programmer.
 
  It all works great. I'm able to upload the basic "blink" sketch onto the chip via the Arduino IDE. There's one major problem. The LED blinks on and off about once every 16 seconds.... leading me to believe the chip is using its internal oscillator of 1MHz instead of the 16Mhz crystal in have installed.

  Sounds like a good theory right? I'm a little unsure though. I'm using some real cheapie crystals I bought from Ebay. The two caps I'm using are good caps, but they're labeled 104 ... which is 100nf instead of the 20-20pf that I should be using.

  Does anyone have experience with this? I'm almost positive it's just using the internal oscillator.

  I was about to test it by de-soldering a leg of the crystal to see if the led will still blink ... but wanted to wait until maybe someone could tell me what might be really happening.

here is what I have in boards.txt (inside my Sanguino folder)

avrispmkii.name=Sanguino w/mkii
avrispmkii.upload.protocol=avrispmkii
avrispmkii.upload.maximum_size=63488
avrispmkii.upload.speed=38400
avrispmkii.upload.using=avrispmkii
avrispmkii.bootloader.low_fuses=0xFF
avrispmkii.bootloader.high_fuses=0xDC
avrispmkii.bootloader.extended_fuses=0xFD
avrispmkii.bootloader.path=atmega644p
avrispmkii.bootloader.file=ATmegaBOOT_644P.hex
avrispmkii.bootloader.unlock_bits=0x3F
avrispmkii.bootloader.lock_bits=0x0F
avrispmkii.build.mcu=atmega644p
avrispmkii.build.f_cpu=16000000L
avrispmkii.build.core=arduino


thanks,
Phil
14  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial Seetron Display on: August 10, 2010, 08:56:26 pm
  Great semi obscure topic here guys. I found this thread while searching (banging my head on the table) for a solution to my problem.

  I have a Mini SSCII Servo controller board from Seetron. I was unable to get my arduino to send the SIMPLE 3 bytes required to move servo position. It was really driving me nuts because I knew all my wiring and code were perfect.

  All it took for me to make it work (after reading this thread) was a single SN74LS04N Hex Inverter I had in my parts box for years.

  I wired the Software Serial TX Pin on my arduino to an input of the hex inverter... took the output of the hex inverter and connected it to the serial input of the Mini SSCII. Whalla it works 100%


 I love these forums. There is just so much valuable information here. I hope this place stays around forever.  ;D



Phil
15  Forum 2005-2010 (read only) / Troubleshooting / Xbee Shield Version 2 from NKC Electronics on: October 29, 2008, 10:19:12 am
Hello everyone,

I'm having a problem finding info on the version 2 xbee shield from NKC. I bought 2 of these a few months back. I'm now starting to play with them. I'm kind of leery about inserting my xbee modules into them right now ... since I don't know what jumpers J1 & J2 do. I plugged the shield onto my arduino ... can't seem to read any voltage off the shield. Zero volts from GND to 3v3 on the shield.

Anyone else having this problem?


thanks,
Phil
Pages: [1] 2 3 4