Loading...
  Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: I2C Slave command on: February 25, 2013, 12:01:47 am
i am sending '1' and '2' which corresponds to 49 and 50
2  Using Arduino / Programming Questions / Re: I2C Slave command on: February 24, 2013, 11:32:06 pm
Hi Nick,

you are right. it doesnt need to. I merely edited from the wire example code given.

Code:
#include <Wire.h>
int led = 13;
int a=0;
void setup()
{
  Wire.begin(4);                // join i2c bus with address #4
  Wire.onReceive(receiveEvent); // register event
 // Serial.begin(9600);           // start serial for output
  pinMode(led, OUTPUT);
}

void loop()
{
  delay(100);
}
void receiveEvent(int howMany)
{
  while(1 < Wire.available()) // loop through all but the last
  {
    char c = Wire.read(); // receive byte as a character
   // Serial.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
 // Serial.println(x);         // print the integer
   switch(x){
 case 49:
 a=500;
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(a);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(a);
 break;
 case 50:
 a=1000;
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(a);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(a);
 break;
 }
}
3  Using Arduino / Programming Questions / Re: I2C Slave command on: February 24, 2013, 11:20:36 pm
Hi Nick, thanks for your input.

I have tried commenting off all serial codelines including that in setup and it still doesnt work. Are there other methods for debugging?
4  Using Arduino / Programming Questions / I2C Slave command on: February 24, 2013, 11:01:50 pm
Hi all,

I am trying to use the master device to command the slave to vary the blinky speed. However, I did not observe the blinky LED lighting up at all. Can someone help me look at my code to see what is wrong? Many thanks.

master device
Code:
void loop()
{
  if (Serial.available() > 0) {
    x = Serial.read();
  Wire.beginTransmission(4); // transmit to device #4
  Wire.write("x is ");        // sends five bytes
  Wire.write(x);              // sends one byte  
  Wire.endTransmission();    // stop transmitting

  }
  delay(500);
}

slave device
Code:
[tr][td]
void receiveEvent(int howMany)
{
  while(1 < Wire.available()) // loop through all but the last
  {
    char c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
  Serial.println(x);         // print the integer
   switch(x){
 case 49:
 a=500;
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(a);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(a);
 break;
 case 50:
 a=1000;
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(a);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(a);
 break;
 }
}
5  Products / Arduino Due / Re: Minimum schematic design for arduino due on: January 24, 2013, 06:29:25 pm
Thanks for all the reply so far. Keep them coming.

I was wondering if anyone in the forum has already build their own customised arduino due on a pcb. From what i see, the development board is at least a 4 layered board. I am currently building a dou le layered 1 and the traces routings are giving me massive problem
6  Products / Arduino Due / Re: Minimum schematic design for arduino due on: January 23, 2013, 07:04:39 pm
What about crystals and such? I only see a 32khz and 12Mhz oscillator. Where is the 90Mhz 1?

I am intending to use the acr isp mkii to program the microcontroller. As such i would like to know all necessary connections i have to connect in order for that to work.

Based on given schematic, i figured i have to at least connect the crystals, the vdd, the gnds, miso, sck, mosi, master reset etc.

Did i miss anything important?
7  Products / Arduino Due / Minimum schematic design for arduino due on: January 22, 2013, 06:32:04 pm
Hi there,

I am trying to build my arduino due from chip and transistors level up on a PCB. I am wondering what is the minimum partlist and schematic design we have to use in order to just program a blinky programme on the customised PCB.

Does anyone knows?

Pages: [1]