Show Posts
Pages: [1] 2 3
1  Using Arduino / Programming Questions / Re: I2C Issues on: April 24, 2013, 04:42:53 am
SUCCESSS!

I changed the breadboard and alligator clips and everything works now!

Thanks a lot for all the help!!
2  Using Arduino / Programming Questions / Re: I2C Issues on: April 24, 2013, 02:17:47 am
On using the I2C scanner it says no device found for the LilyPad, I even swapped the LilyPad with a friend and it still has the same output

The Uno is detected immediately at the correct address

3  Using Arduino / Programming Questions / Re: I2C Issues on: April 23, 2013, 10:50:07 pm
Ok I got the Mega to work after a couple of resets, however as soon as I plug in the LilyPad into the I2C bus the Mega either stops printing, or continues to print error 2.

I am using USB power at the moment so everything should be 5V right?
4  Using Arduino / Programming Questions / Re: I2C Issues on: April 23, 2013, 02:56:20 pm
And now my Aruino Mega 2560 which I was using as the master and was printing fine so far has stopped printing to the Serial Monitor completely. With no change to the code.

I tried uploading the blink example and it worked so I know the serial hardware is ok. smiley-confuse
5  Using Arduino / Programming Questions / Re: I2C Issues on: April 23, 2013, 02:45:58 pm
My master controller also tends to "hang" as in no-output to the serial monitor after a few failed transmissions, is this normal?
6  Using Arduino / Programming Questions / Re: I2C Issues on: April 23, 2013, 02:36:20 pm
Grounds are connected well, will check the other connections and let you know ASAP
7  Using Arduino / Programming Questions / Re: I2C Issues on: April 23, 2013, 01:18:34 pm
Ok so I am temporarily powering the LilyPad through USB, however I cannot transfer to it successfully via I2C, even when I remove all other devices.

My Uno works perfectly with almost exactly the same code whereas with the LilyPad the Wire.endtransmission is always returning a value of 2 (received NACK on transmit of address).

Any idea how to solve this?

The Lilypad code is as follows:

Code:
#include <Wire.h>
int i = 0;
int led = 13;
volatile boolean datain;
volatile int data;
void setup()
{ pinMode(3, OUTPUT);         
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);         
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(led, OUTPUT);
  Wire.begin(5);                // join i2c bus with address #5
  Wire.onReceive(receiveEvent); // register event
}

void loop()
{
  if (datain)
   { datain = false;
     switch (data)
     {
       case 1:              //Switch all motors on
       analogWrite(3, 255);
       analogWrite(5, 255);
       analogWrite(6, 255);
       analogWrite(9, 255);
       analogWrite(10, 255);
       analogWrite(11, 255);
       break;
       
       case 2:              // Switch all motors off
       analogWrite(3, 0);
       analogWrite(5, 0);
       analogWrite(6, 0);
       analogWrite(9, 0);
       analogWrite(10, 0);
       analogWrite(11, 0);
       break;
       
       case 3:              // Switch all motors off
       analogWrite(3, 125);
       analogWrite(5, 125);
       analogWrite(6, 125);
       analogWrite(9, 125);
       analogWrite(10, 125);
       analogWrite(11, 125);
       break;
       
       case 4:
        for (int i=0; i<=255; i++)
        {
          analogWrite(11, i);
          delay(10);
        }
        delay(500); //Hold it!
          //Decrease Motor Speed from 255 -> 0
        for(int i=255; i>=0; i--)
        {
          analogWrite(11, i);
          delay(10);
        }
        delay(500); //Hold it!
        break;
       
        default:
        break;
     }
  }
}
void receiveEvent(int howMany)
{    datain = true;
     data =  Wire.read(); // receive byte

   
8  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 02:29:47 pm
Yup I'll probably try a couple of different batteries before trying the level shifter
9  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 12:26:42 pm
Yeah I will try to experiment and see what happens, since the LilyPad only has an input range of 2.7V to 5.5V, 2 or 3 AA batteries will be less and 4 will be too high.....

Will reducing the I2C voltage to 3.3V help?
10  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 10:44:09 am
Yeah the buffers now seem to make sense, the whole program runs very well with the Uno now!
Many thanks Erdin!

Just trying to figure out how to power my LilyPad, I mean it has no JST connectors so no LiPo batteries.

And it dosent run through my Uno. Will running the LilyPad with 2xAA batteries be abetter idea? Or should I power my Uno with 4xAA batteries and then try to power the LilyPad through the 5V pin?

Because I am based in Singapore and Sparkfun products aren't easy to get here, it can take almost a week to get the LilyPad power supply from local retailers since it is currently not in stock.
11  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 04:55:13 am
What battery do you suggest?
12  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 04:47:40 am
Yeah I am powering the Uno through a 9V battery and connected its 5V pin to the + pin on the LilyPad, by the way Erdin thanks for your advice, could you send me your name I would like to acknowledge your help in my project report
13  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 04:40:36 am
Ok, I thought it was possible to power it through the 5V pin for the Uno, since I saw it on one of the threads.
14  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 04:33:47 am
**UPDATE***

I removed a Lilypad that was connected as another slave but was powered through the 5V pin of my Arduino Uno which i was using as the slave device and now the Uno works perfectly! No other changes!

Any idea why this happened? Because I do need the LilyPad to work as well!
15  Using Arduino / Programming Questions / Re: I2C Issues on: April 22, 2013, 04:27:43 am
Still no change....
Pages: [1] 2 3