Show Posts
Pages: 1 ... 15 16 [17] 18 19
241  Using Arduino / Programming Questions / Re: Blink without delay and millis but with the DS1307 :) on: February 15, 2012, 05:00:39 pm
That's interesting, thanks for the info.
242  Using Arduino / Programming Questions / Re: Blink without delay and millis but with the DS1307 :) on: February 15, 2012, 04:40:18 pm
Ha, that works. These simple things sometime look so difficult  smiley-roll-blue Thank you.
243  Using Arduino / Programming Questions / Blink without delay and millis but with the DS1307 :) on: February 15, 2012, 04:19:53 pm
I want to use a DS1307 RTC in a home automation project to do certain time based things. I have a small DS1307 board and have managed to make it work with various sketches that I've found online. This code was very handy -> http://combustory.com/wiki/index.php/RTC1307_-_Real_Time_Clock
Now I thought lets try to make a sketch like the blink without delay example but using the data from the DS1307.
But I'm getting nowhere, I don't really have a clue how I should make this sketch... Anyone that can help me?
I've made the following sketch, which does not work.
Code:
/*
 Blink without delay using a DS1307
 Led blinks once every second.
 */

#include <Wire.h>
const int DS1307_I2C_ADDRESS = 0x68;

const int led =  13;      // the number of the light pin
int ledState = LOW;

byte second, minute, hour;

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

void getDateDs1307()
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0x00);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_I2C_ADDRESS, 3);

  second     = bcdToDec(Wire.receive() & 0x7f);
  minute     = bcdToDec(Wire.receive());
  hour       = bcdToDec(Wire.receive() & 0x3f);
}

void setup() {
  Wire.begin();
  pinMode(led, OUTPUT);     
}

void loop(){

  getDateDs1307();
  int time1 = second;

  getDateDs1307();
  int time2 = second;
  if (abs(time1 - time2) > 1)
  {
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(led, ledState);
  }
}
244  Using Arduino / Motors, Mechanics, and Power / Re: Arduino mega2560 + MD25 on: February 14, 2012, 12:23:01 pm
Post the sketch you are trying to run.
245  Using Arduino / Networking, Protocols, and Devices / Re: rf2401 problem with mega 2560 on: February 07, 2012, 12:45:21 pm
That's very interesting, I'll definitely try that.
246  Using Arduino / Sensors / Re: (ask)accelerometer up to 20G? on: February 06, 2012, 02:50:55 pm
Is 16g enough? Then you could use the BMA180 or ADXL345. Both can be setup to sense up to 16g.
247  Using Arduino / Networking, Protocols, and Devices / Re: rf2401 problem with mega 2560 on: February 04, 2012, 02:52:20 pm
Well I got it working after trying lots of things. I found a solution but it's a bit weird. When I connect the RF24 module to my Mega 2560 and take the 3,3V from my lab power supply it works... 100% response rate. My Mega 2560 is a Chinese clone, maybe it has bad 3,3 voltage circuit, I don't know. But it works smiley
I found this out because I have 4 RF24 modules, 2 small ones with the antenna on the board and 2 big ones with preamp and amp and external antenna. The big ones draw quite a lot of current and you must power them from a separate power supply. I first tested the 2 small ones and ran in to the above problems. After a lot of head scratching I thought that maybe I had a bad module so I connected the 2 big ones and used external power, they worked. I then tried the 2 small ones using the same power supply and they suddenly worked like they should. I then removed the external power supply from the one connected to my Uno and that also worked. When I removed the external power from the one connected to the Mega 2560 and used the 3,3V from the Mega it stopped working, switching back to the external power supply everything was back ok. Weird things... On my Uno and Duemilanove I can use the internal 3,3V but not on the Mega 2560.

248  Using Arduino / General Electronics / Re: solder station question on: February 04, 2012, 07:55:57 am
I thought Japan used 100V, 50 or 60Hz depending on the region. I assume you are in the UK, where you have 230V? If it's made for 100V you will need a transformer.
249  Using Arduino / Programming Questions / Re: Copying Images from laptop to SD Card Using Arduino Mega2560 on: February 03, 2012, 03:45:37 pm
I use this with my Mega 2560 and sd card: const int chipSelect = 53;
250  Using Arduino / Motors, Mechanics, and Power / Re: New 28BYJ-48 library on: January 30, 2012, 04:43:49 pm
Haha, many times I have almost ordered a Gigapan. But the local camera shop over here wants 1000€ for the pro version. Which I need for my Nikon D300/700. Never heard of the Bescor, looks like a nice cheap solution. It's on my wanted list, thanks for the info.
251  Using Arduino / Motors, Mechanics, and Power / Re: New 28BYJ-48 library on: January 30, 2012, 02:48:47 pm
I just tried it out, had not seen that you posted the .pde file  smiley-red It does work very well. I've thought about buying a cheap tripod and add a stepper motor to it to make 360 pano's. Might be possible with this little motor? That's quite a bit of code you have written, hats off to you!
252  Using Arduino / Motors, Mechanics, and Power / Re: New 28BYJ-48 library on: January 30, 2012, 01:08:30 pm
Could please post an example sketch using the code # button? I can't figure out the code in the first post.
253  Using Arduino / General Electronics / Re: Power from wall socket with USB connected? on: January 29, 2012, 05:18:00 am
I power the nrf24l01 from the 3,3V pin, according to the official Arduino website the 3,3V bus is limited to 50mA. The datasheet of the nrf24l01 says that the chip only draws 12mA max. If I connect the module to my Uno I works without problems (powered by USB only). Weird  smiley-confuse
254  Using Arduino / General Electronics / Re: Power from wall socket with USB connected? on: January 28, 2012, 04:57:31 pm
Ok, thank you.
255  Using Arduino / General Electronics / Power from wall socket with USB connected? on: January 28, 2012, 04:01:07 pm
Will this work? Connect a 9V/1,1A power adapter AND usb cable from my pc to read the serial monitor. Will the Arduino Mega 2560 select the power adapter and can the USB still be used to read the serial monitor?
It's just for testing purposes, I'm having some strange issues with my Mega 2560 connected to a nRF24L01+. When I just have the USB cable connected I get very bad reception and lots of time outs but with the power adapter connected it seems to work fine. I want to have a look with the serial monitor to see what happens.
Pages: 1 ... 15 16 [17] 18 19