Show Posts
Pages: [1] 2 3
1  International / Nederlands / Re: automatiseren generator on: January 09, 2013, 06:44:06 am

Gevonden, op Github : https://github.com/arduino/Arduino/tree/master/libraries/SoftwareSerial

Alleen kan je daarvan niet downloaden, en moet ik elk filetje apart, openen, alles selecteren, knippen, in een textfiletje plakken, en dan in de libraries map zetten.
Fijn is dat.
Gelukkig is het niet zo'n grote librarie.

De about-pagina van Github meldt:
Quote
GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers.
Dat zal wel cynisch bedoeld zijn dan.




Is gewoon even wennen.
Dat je niet kan downloaden komt omdat je ergens in een mapje zit dat tot een groter archief behoord.
Als je even op "code" klikt bovenaan zal je een icoontje krijgen genaamd "ZIP". Dit is Uw download-knop..
2  International / Nederlands / Re: Koop, download,installeer, advies on: November 15, 2012, 01:35:29 pm

Is er een sketch waarmee ik simpel kan kijken of ik de arduino werkend heb.
Ik bedoel iets van een webinterface oid..
Of een simpel iets om te controleren, zonder nog meer lampjes enz enz er op aan te sluiten...

Simpel.. webinterface..
Nooit Arduino gebruikt...
Slecht plan...

Begin met Blink.
Maar verander int led = 13 naar 9.
Van http://arduino.cc/en/Main/ArduinoBoardEthernet:
 LED: 9. There is a built-in LED connected to digital pin 9. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off. On most other arduino boards, this LED is found on pin 13. It is on pin 9 on the Ethernet board because pin 13 is used as part of the SPI connection.

Quote
Alleen is de solar meter nog iets te complex, aangezien daar meteen data enz gegenereerd moet worden..
Hierdoor krijg ik de sketch niet geupload, omdat er veel fouten in zitten.

Die sketch kan inderdaad nog wat te complex zijn.

De sketch zoals je hem download van de website die je opgeeft compileert foutloos..Als je de bestandjes in het archief op de juiste plaats zet. Libraries bij libraries en de andere bestanden moeten zich in dezelfde folder bevinden als Solarmeter.ino, welke je gaat compileren.

Als je echt onmiddellijk met dit ethernet-shield willen beginnen, dan kun je een een kijkje gaan nemen bij Adafruit.
http://www.ladyada.net/learn/arduino/ethfiles.html

Dit is een goede tutorial die stap voor stap de zaken gaat behandelen.
3  Using Arduino / Storage / Re: Can this be achieved (Loading a skech from an sd card) on: November 08, 2012, 03:41:23 pm
something like this maybe:
http://baldwisdom.com/category/hacking/arduino/bootdrive/
4  Using Arduino / LEDs and Multiplexing / Re: Need help with 32x16 monocolor LED on: October 11, 2012, 06:24:44 am
You could try to reverse-engineer it. There's a couple of IC's on the pcb. Start by making some pictures and writing down the typenumbers of the chips.
You could then see if these are commonly used parts and get their datasheets. It's quite a challenge sometimes though..
5  Using Arduino / Displays / Re: Connecting DOGM132 to Arduino Uno questions. on: September 14, 2012, 11:38:10 am
I've come up with one more question. I finally bought a LED back light and I was following the DOGM132 shield schematics (from here: http://code.google.com/p/dogm128/wiki/dogm132_arduino_shield). The question is - how come that you need a 30ohm resistor for 5V supply. By Ohm's Law it would use up to 150mA from Arduino's 5V pin, which is way over 40mA max that Arduino supports. Or am I missing something here, like internal resistance of LED55X31 board? The specification states, that it would use up to 30mA though. :/

It's just hard for me (a newbie) to get a grip on this Ohm's law and these extra unknowns.

Your doing fine. You almost got it.. The 'internal resisitance' is in series with the 30 ohm resistor and creates a voltage divider.
The calculation is like you would calculate the resistance for a LED:
A red LED has a forward voltage drop of about 1.2 to 1.6V (blues have more)
So the voltage across the resistor is 5-1.6 = 3.4V
If you want it to burn with a 20 mA current you divide 3.4 by 0.02 which is 170 ohms. Since this is not a current value, you would take 180 Ohms.
For your display we work the other way around:
Remember  that in series the current through all of the components is the same, it's the voltage which gets divided.
If your display draws 30 mA and the series-resistor is 30 Ohm, the voltage across the resistor is 0.03 x 30 = 0.9v
So the forward voltage drop of your display is 5 - 0.9 = 4.1V
You may come across this number on the datasheet..
6  Using Arduino / Displays / Re: M2tklib: Menu and User Interface Library on: September 11, 2012, 10:24:27 am
Hi,

I am using your great library to construct a menu system for reptile climate system I am designing.
After some initial troubles I believe I am on the right track now..
My display is a 192x64 bought of Ebay...
This is the code untill now:
Code:
#include <glcd.h> // inform Arduino IDE that we will use GLCD library
#include "M2tk.h"
#include "utility/m2ghglcd.h"

uint8_t uiKeySelectPin = 3;
uint8_t uiKeyDownPin = 2;
uint8_t uiKeyUpPin = 1;
uint8_t uiKeyExitPin = 0;

uint8_t dt_day = 1;
uint8_t dt_month = 1;
uint8_t dt_year = 12;

uint8_t ti_hour = 1;
uint8_t ti_mins = 1;
uint8_t ti_secs = 12;

uint8_t li_sr_hour = 9;
uint8_t li_sr_mins = 0;
uint8_t li_rt_mins = 30;
uint8_t li_ss_hour = 20;
uint8_t li_ss_mins = 0;


uint8_t li_tl_hour = 2;
uint8_t li_tl_mins = 0;
uint8_t li_ft_mins = 30;

uint8_t th_d_temp = 22;
uint8_t th_n_temp = 18;
uint8_t th_d_humi = 70;
uint8_t th_n_humi = 75;
uint8_t th_b_temp = 5; // basking temp increase
//=================================================

// Forward declaration of the toplevel element
M2_EXTERN_ALIGN(top_el_expandable_menu);
//= Set date menu =
M2_U8NUM(el_dt_day, "c2", 1,31,&dt_day);
M2_LABEL(el_dt_sep1, "b1", "/");               
M2_U8NUM(el_dt_month, "c2", 1,12,&dt_month);
M2_LABEL(el_dt_sep2, "b1", "/");
M2_LABEL(el_dt_sep3, "b1","20");               
M2_U8NUM(el_dt_year, "c2", 12,99,&dt_year);

M2_LIST(list_date) = { &el_dt_day, &el_dt_sep1, &el_dt_month, &el_dt_sep2, &el_dt_sep3, &el_dt_year };
M2_HLIST(el_date, NULL, list_date);

M2_ROOT(el_dt_cancel, NULL, "CANCEL", &top_el_expandable_menu);
M2_BUTTON(el_dt_ok, NULL, "OK", dt_ok_fn);
M2_LIST(list_dt_buttons) = {&el_dt_cancel, &el_dt_ok };
M2_HLIST(el_dt_buttons, NULL, list_dt_buttons);

M2_LIST(list_dt) = {&el_date, &el_dt_buttons };
M2_VLIST(el_top_dt, NULL, list_dt);

//= Set time menu =

M2_U8NUM(el_ti_hour, "c2", 0,23,&ti_hour);
M2_LABEL(el_ti_sep1, "b1", ":");
M2_U8NUM(el_ti_mins, "c2", 0,59,&ti_mins);
M2_LABEL(el_ti_sep2, "b1", ":");
M2_U8NUM(el_ti_secs, "c2", 0,59,&ti_secs);

M2_LIST(list_time) = { &el_ti_hour, &el_ti_sep1, &el_ti_mins, &el_ti_sep2, &el_ti_secs };
M2_HLIST(el_time, NULL, list_time);

M2_ROOT(el_ti_cancel, NULL, "CANCEL", &top_el_expandable_menu);
M2_BUTTON(el_ti_ok, NULL, "OK", ti_ok_fn);
M2_LIST(list_ti_buttons) = {&el_ti_cancel, &el_ti_ok };
M2_HLIST(el_ti_buttons, NULL, list_ti_buttons);

M2_LIST(list_ti) = {&el_time, &el_ti_buttons };
M2_VLIST(el_top_ti, NULL, list_ti);

//= Set lighting menu
 
M2_LABEL(el_li_tit1,"b1", "Set sunrise  : ");
M2_U8NUM(el_li_sr_hour, "c2", 0,23,&li_sr_hour);
M2_LABEL(el_li_sep1, "b1", ":");
M2_U8NUM(el_li_sr_mins, "c2", 0,59,&li_sr_mins);
M2_LIST(list_li_sr) = { &el_li_tit1, &el_li_sr_hour, &el_li_sep1, &el_li_sr_mins };
M2_HLIST(el_li1, NULL, list_li_sr);

M2_LABEL(el_li_tit2,"b1", "Set risetime : ");
M2_U8NUM(el_li_rt_mins, "c2", 1,59,&li_rt_mins);
M2_LIST(list_li_rt) = { &el_li_tit2, &el_li_rt_mins};
M2_HLIST(el_li2, NULL, list_li_rt);

M2_LABEL(el_li_tit3,"b1", "Set sunset   : ");
M2_U8NUM(el_li_ss_hour, "c2", 0,23,&li_ss_hour);
M2_LABEL(el_li_ss_sep, "b1", ":");
M2_U8NUM(el_li_ss_mins, "c2", 0,59,&li_ss_mins);
M2_LIST(list_li_ss) = { &el_li_tit3, &el_li_ss_hour, &el_li_ss_sep, &el_li_ss_mins };
M2_HLIST(el_li3, NULL, list_li_ss);

M2_LABEL(el_li_tit4,"b1", "Set twilight : ");
M2_U8NUM(el_li_tl_hour, "c2", 0,23,&li_tl_hour);
M2_LABEL(el_li_tl_sep, "b1", ":");
M2_U8NUM(el_li_tl_mins, "c2", 0,59,&li_tl_mins);
M2_LIST(list_li_tl) = { &el_li_tit4, &el_li_tl_hour, &el_li_tl_sep, &el_li_tl_mins };
M2_HLIST(el_li4, NULL, list_li_tl);

M2_LABEL(el_li_tit5,"b1", "Set fadetime : ");
M2_U8NUM(el_li_ft_mins, "c2", 1,59,&li_ft_mins);
M2_LIST(list_li_ft) = { &el_li_tit5, &el_li_ft_mins};
M2_HLIST(el_li5, NULL, list_li_ft);

M2_LABEL(el_li_spacer,"b1", "       ");
M2_ROOT(el_li_cancel, NULL, "CANCEL", &top_el_expandable_menu);
M2_LABEL(el_li_spacer2,"b1", "   ");
M2_BUTTON(el_li_ok, NULL, "OK", li_ok_fn);
M2_LIST(list_li_buttons) = {&el_li_spacer, &el_li_cancel, &el_li_spacer2, &el_li_ok };
M2_HLIST(el_li_buttons, NULL, list_li_buttons); 
 
M2_LIST(list_li) = {&el_li1, &el_li2, &el_li3, &el_li4, &el_li5, &el_li_buttons };
M2_VLIST(el_top_li, NULL, list_li);
 
// == Set temp & humidity
M2_LABEL(el_th_tit1,"b1", "Set day temperature   : ");
M2_U8NUM(el_th_d_temp, "c2", 18,55,&th_d_temp);
M2_LABEL(el_th_unit1,"b1", "C");
M2_LIST(list_th_dt) = { &el_th_tit1, &el_th_d_temp, &el_th_unit1};
M2_HLIST(el_th1, NULL, list_th_dt);

M2_LABEL(el_th_tit2,"b1", "Set night temperature : ");
M2_U8NUM(el_th_n_temp, "c2", 15,55,&th_n_temp);
M2_LABEL(el_th_unit2,"b1", "C");
M2_LIST(list_th_nt) = { &el_th_tit2, &el_th_n_temp, &el_th_unit2};
M2_HLIST(el_th2, NULL, list_th_nt);

M2_LABEL(el_th_tit3,"b1", "Set day humidity      : ");
M2_U8NUM(el_th_d_humi, "c2", 55,99,&th_d_humi);
M2_LABEL(el_th_unit3,"b1", "%");
M2_LIST(list_th_dh) = { &el_th_tit3, &el_th_d_humi, &el_th_unit3};
M2_HLIST(el_th3, NULL, list_th_dh);

M2_LABEL(el_th_tit4,"b1", "Set night humidity    : ");
M2_U8NUM(el_th_n_humi, "c2", 55,99,&th_n_humi);
M2_LABEL(el_th_unit4,"b1", "%");
M2_LIST(list_th_nh) = { &el_th_tit4, &el_th_n_humi, &el_th_unit4};
M2_HLIST(el_th4, NULL, list_th_nh);

M2_LABEL(el_th_spacer,"b1", "       ");
M2_ROOT(el_th_cancel, NULL, "CANCEL", &top_el_expandable_menu);
M2_LABEL(el_th_spacer2,"b1", "   ");
M2_BUTTON(el_th_ok, NULL, "OK", th_ok_fn);
M2_LIST(list_th_buttons) = {&el_th_spacer, &el_th_cancel, &el_th_spacer2, &el_th_ok };
M2_HLIST(el_th_buttons, NULL, list_th_buttons); 
 
M2_LIST(list_th) = {&el_th1, &el_th2, &el_th3, &el_th4, &el_th_buttons };
M2_VLIST(el_top_th, NULL, list_th);


// Left entry: Menu name. Submenus must have a '.' at the beginning
// Right entry: Reference to the target dialog box (In this example all menus call the toplevel element again
m2_menu_entry m2_2lmenu_data[] =
{
  { "Set time & date", &top_el_expandable_menu },
  { ". Set time", &el_top_ti },
  { ". Set date", &el_top_dt },
  { "Set temp & humidity", &el_top_th },
  { "Set lighting", &el_top_li },
  { "Review settings", &top_el_expandable_menu},
  { NULL, NULL },
};

// The first visible line and the total number of visible lines.
// Both values are written by M2_2LMENU and read by M2_VSB
uint8_t m2_2lmenu_first;
uint8_t m2_2lmenu_cnt;

// M2_2LMENU definition
// Option l4 = four visible lines
// Option e15 = first column has a width of 15 pixel
// Option W43 = second column has a width of 43/64 of the display width

M2_2LMENU(el_2lmenu,"l5e10W54",&m2_2lmenu_first,&m2_2lmenu_cnt, m2_2lmenu_data,'+','-','\0');
M2_SPACE(el_space, "W1h1");
M2_VSB(el_vsb, "l5W2r1", &m2_2lmenu_first, &m2_2lmenu_cnt);
M2_LIST(list_2lmenu) = { &el_2lmenu, &el_space, &el_vsb };
M2_HLIST(el_hlist, NULL, list_2lmenu);
M2_ALIGN(top_el_expandable_menu, "-1|1W192H64", &el_hlist);

// m2 object and constructor
M2tk m2(&top_el_expandable_menu, m2_es_arduino, m2_eh_4bs, m2_gh_glcd_ffs);


//========================== 
  void setup() {
  m2.setPin(M2_KEY_SELECT, uiKeySelectPin);
  m2.setPin(M2_KEY_NEXT, uiKeyDownPin);
  m2.setPin(M2_KEY_PREV, uiKeyUpPin);
  m2.setPin(M2_KEY_EXIT, uiKeyExitPin);
 
}

void loop() {

  m2.checkKey();
  if ( m2.handleKey() ) {
      m2.draw();
  }
}
void dt_ok_fn(m2_el_fnarg_p fnarg)  {
  m2_SetRoot(&top_el_expandable_menu);
}
void ti_ok_fn(m2_el_fnarg_p fnarg)  {
  m2_SetRoot(&top_el_expandable_menu);
}
void li_ok_fn(m2_el_fnarg_p fnarg)  {
  m2_SetRoot(&top_el_expandable_menu);
}
void th_ok_fn(m2_el_fnarg_p fnarg)  {
  m2_SetRoot(&top_el_expandable_menu);
}

I still have some issues though:

In the 'set lightning' menu I run out of space on my LCD... How (if any) can I add a scrollbar to this?
The last option in the main menu is to review all the settings. Here I want to list all the values I have entered in the previous menus.
So do I make a whole new label array or can I use the ones created before? and again... a scrollbar

Please let me know what you think of the code so far and any remarks/corrections you might have.
Thanks.
7  International / Nederlands / Re: arduino met relay control en Timer restart how to do? on: September 06, 2012, 01:27:53 pm
ben nog even terug gegaan naar jou code

ik kreeg daarbij een foutmelding
iets met scope.

heb deze nu zonder compile errors maar als ik hem dan upload naar het board schakeld led13 de onboard led niet uit na 5 sec

--

Code:
void setup()
{

unsigned long startime = 0;
unsigned long endtime = 0;
int relaispin = 13; // relais aan pin 10
int inpin = 3; // input aan pin 9
}

void loop()
{
  unsigned long starttime = 0;
unsigned long endtime = 0;
  int relaispin = 13;
  int inpin = 3;
  pinMode(relaispin, OUTPUT);
  pinMode(inpin, INPUT);
if (inpin = 1 ) { // input hoog
digitalWrite(relaispin, HIGH);         // relais schakelen
starttime = millis(); // huidige 'tijd'
endtime = starttime + 5000;     // gewenste vertragingstij = 40minuten * 60 * 1000
}
if (millis() >= endtime) { //tijd verstreken?
digitalWrite(relaispin, LOW);    //relais afschakelen
}
}
Je declareerd 2 keer hetzelfde. In setup zeg je dat startime en endtime unsigned long zijn met een waarde '0'
Dan doe je hetzelfde nog eens in de 'main' loop.(maar deze keer starttime)
Dat betekend dus wel dat wanneer de loop terug begint (dus na " if (millis() >= endtime).. etc " deze 2 waardes terug op nul gezet worden.

BTW: probeer eens de code-knop # als je code post. Makkelijker om te lezen.


8  International / Nederlands / Re: arduino met relay control en Timer restart how to do? on: September 05, 2012, 10:25:13 am
ok heeft even wat uurtjes experimenteren gekost maar het werkt in basis nu.

nu nog alleen de code aanpassen voor de verschillende relays uitgangen en ik ben up and running


hier is de code tot nu toe

wat ik vreemd vind is als ik delay(500) ( of andere hogere waarde ) niet erin zet dan werkt het niet , zet ik hem wel erin dan na ~10 sec blijft de led uit ongeacht de input status.

-
  unsigned long starttime = 0;
  unsigned long endtime = 0;  
  starttime = millis();              // huidige 'tijd'
  endtime = 10000;             // gewenste vertragingstij voor test 5 sec = 40minuten * 60 * 1000

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (millis() > endtime) {       //tijd verstreken?
digitalWrite(ledPin, LOW);        //relais afschakelen
delay(500);
}


millis() is een altijd optellende waarde welke aangeeft hoelang het huidige programma aan het lopen is. Deze waarde loopt over na 4294967296 ms (+/- 50 dagen.
Je moet daarom je eindtijd bepalen door de huidige waarde van millis() te nemen en daar de gewenste vertraging bij op te tellen.
In Uw code zal het 1x werken, nl. na 10 seconden. Daarna is millis() 10000 voorbij en zal het een dag of 50 later, als millis voorbij 4294967295 gaat en terug op 0 komt, nog eens werken...
9  International / Nederlands / Re: Goede opbouw programma on: September 04, 2012, 05:17:22 pm
Je kan een interrupt aan die input-pin 'knopen'
Zoals hier:

Code:
const byte LED = 13;
const byte BUTTON = 2;

// Interrupt Service Routine (ISR)
void pinChange ()
{
  if (digitalRead (BUTTON) == HIGH)
    digitalWrite (LED, HIGH);
  else
    digitalWrite (LED, LOW);
}  // end of pinChange

void setup ()
{
  pinMode (LED, OUTPUT);  // so we can update the LED
  digitalWrite (BUTTON, HIGH);  // internal pull-up resistor
  attachInterrupt (0, pinChange, CHANGE);  // attach interrupt handler
}  // end of setup

void loop ()
{
  // loop doing nothing
}

Dit voorbeeld is afkomstig van deze website: http://www.gammon.com.au/forum/?id=11488
Een heel informatieve site met duidelijke uitleg (als je engels verstaat) gerund door Nick Gammon, een van de moderators hier.
10  International / Nederlands / Re: arduino met relay control en Timer restart how to do? on: September 04, 2012, 05:09:45 pm
zoiets ongeveer?
Code:
void setup()
{

unsigned long startime = 0;
unsigned long endtime = 0;
int relaispin = 10; // relais aan pin 10
int inpin = 9; // input aan pin 9
}

void loop()
{
if (inpin =1 ) { // input hoog
digitalWrite(relaispin, HIGH);         // relais schakelen
startime = millis(); // huidige 'tijd'
endtime = starttime + 2400000;     // gewenste vertragingstij = 40minuten * 60 * 1000
}
if (millis() >= endtime) { //tijd verstreken?
digitalWrite(relaispin, LOW);    //relais afschakelen
}
}
11  Using Arduino / Displays / Re: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno on: August 31, 2012, 10:21:51 am
?

How do I know which address to use as well? I have seen a lot of 0x27 stuff

I was using the LiquidCrystal_I2C lcd( 0x27, 20, 4); to initiate the LCD...


I noticed you also posted in this thread:http://arduino.cc/forum/index.php/topic,119502.15.html
So by now you have already found and used the I2C-scanner found here:http://arduino.cc/playground/Main/I2cScanner
This is the adress you need to put in the declaration.
12  Using Arduino / Microcontrollers / Re: How to programm Arduino 2560 using Arduino UNO as ISP on: August 28, 2012, 10:20:46 am
Googmorning,

please, is there a way to programm my Arduino Mega 2560 (and change its default bootloader) using an Arduino UNO as ISP? I had to insert watchdog feature, so a I recompiled bootloader and now I've to burn it but I've not any external programmer!
Searching in google, I've found lots of link and web page but no clear guides or tutorial...

Thans in advance  smiley
seo08

Try this one: http://www.gammon.com.au/forum/?id=11635
It's from Nick Gammon, a mod here on the forum. It's very clear and well written. (and it works well too..)

 
13  Using Arduino / LEDs and Multiplexing / Re: Multiple Output on 1 LED problem on: August 25, 2012, 09:20:44 am
Something like this:

Code:

if(((now.hour()==HOUR1)&&(now.minute()==MINUTE1)))
{

if(flag == 1)
{
lcd.setCursor(9,1);
lcd.print(" Med 1 ");
lcd.println();
digitalWrite(LED,HIGH);
delay(10000); //delay for 25sec
lcd.clear(); //Delete the Display of Medicine after the buzzer
delay(1000); //Delay time for the lcd.clear function
flag = 0; // clear flag
delay(1000);
}
else {

digitalWrite(LED,LOW);
}
}


and here is the part of the code which I use to light up again the same LED when the arduino compares the time in the RTC and in my laptop

Code:
if(((now.hour()==HOUR4)&&(now.minute()==MINUTE4)))
{
if(flag4 == 1)
{
lcd.setCursor(9,1);
lcd.print(" Med 1 ");
lcd.println();
digitalWrite(LED2,HIGH);
delay(5000); //delay for 1sec
lcd.clear(); //Delete the Display of Medicine after the buzzer
delay(1000); //Delay time for the lcd.clear function
flag4 = 0; // clear flag
delay(1000);
}
else {
digitalWrite(LED,LOW);
}
}
}

The first part of the comparing code is working and shows the result I want which lights up the LED1 for 10 seconds and then turns it off after.  but on the 2nd part of the code when the time comparing is equal. i cannot light up the SAME LED1. do you know guys why is it like that? here is the copy of the whole code:


Code:
#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// Create RTC object
RTC_DS1307 RTC;


// Assign LED to digital pin 13
const int LED = 8;
const int LED2 = 9;
const int LED3 = 10;


// Flag for entering LED routines
uint8_t flag = 1;
uint8_t flag2 = 1;
uint8_t flag3 = 1;
uint8_t flag4 = 1;
uint8_t flagbuzz = 1; //flag comparison for Buzzer

// Set alarm to activate two times a day
byte HOUR1 = 19, MINUTE1 = 54;
byte HOUR2 = 19, MINUTE2 = 55;
byte HOUR3 = 19, MINUTE3 = 56;
byte HOUR4 = 19, MINUTE4 = 57;


void setup ()
{

pinMode(LED,OUTPUT); // LED pin as output
digitalWrite(LED,LOW); // Turn off LED by default

pinMode(LED2,OUTPUT); // LED pin as output
digitalWrite(LED2,LOW); // Turn off LED by default

pinMode(LED3,OUTPUT); // LED pin as output
digitalWrite(LED3,LOW); // Turn off LED by default


Serial.begin(57600); // Initialize serial & set baudrate

Wire.begin(); // Initialize I2C 2 wires interface
RTC.begin(); // Initialize DS1307 RTC chip
lcd.begin(16, 2); // Initialize LCD Interface

if (! RTC.isrunning()) // If RTC is not running, set the time
{
lcd.print("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}
}

void loop ()
{
// Read current time from RTC chip
DateTime now = RTC.now();
// Send current time to serial for debugging
// Using the lcd.print(); it display the former Serail.print to the LiquidCrystal lcd.setCursor(3,0);
// Date Display code

lcd.setCursor(3,0);
lcd.print(now.year(),DEC);
lcd.print('/');
lcd.print(now.month(),DEC);
lcd.print('/');
lcd.print(now.day(),DEC);
lcd.print(' ');

// Time Display code
lcd.setCursor(0,1);
lcd.print(now.hour(),DEC);
lcd.print(':');
lcd.print(now.minute(),DEC);
lcd.print(':');
lcd.print(now.second(),DEC);
lcd.println();
lcd.setCursor(8,1);
lcd.print(" ");


//Start of codes for alarm and Medicine number number display
// led red
if(((now.hour()==HOUR1)&&(now.minute()==MINUTE1)))
{

if(flag == 1)
{
lcd.setCursor(9,1);
lcd.print(" Med 1 ");
lcd.println();
digitalWrite(LED,HIGH);
delay(10000); //delay for 25sec
lcd.clear(); //Delete the Display of Medicine after the buzzer
delay(1000); //Delay time for the lcd.clear function
flag = 0; // clear flag
delay(1000);
}
else {

digitalWrite(LED,LOW);
}
}

// led yellow
if(((now.hour()==HOUR2)&&(now.minute()==MINUTE2)))
{
if(flag2 == 1)
{
lcd.setCursor(9,1);
lcd.print(" Med 2 ");
lcd.println();
digitalWrite(LED2,HIGH);
delay(5000); //delay for 1sec
lcd.clear(); //Delete the Display of Medicine after the buzzer
delay(1000); //Delay time for the lcd.clear function
flag2 = 0; // clear flag
delay(1000);
}
else
{
digitalWrite(LED2,LOW);
}
}
if(((now.hour()==HOUR3)&&(now.minute()==MINUTE3)))
{
if(flag3 == 1)
{
lcd.setCursor(9,1);
lcd.print(" Med 3 ");
lcd.println();
digitalWrite(LED3,HIGH);
delay(5000); //delay for 1sec
lcd.clear(); //Delete the Display of Medicine after the buzzer
delay(1000); //Delay time for the lcd.clear function
flag3 = 0; // clear flag
delay(1000);
}
else
{
digitalWrite(LED3,LOW);
}


if(((now.hour()==HOUR4)&&(now.minute()==MINUTE4)))
{
if(flag4 == 1)
{
lcd.setCursor(9,1);
lcd.print(" Med 1 ");
lcd.println();
digitalWrite(LED,HIGH);
delay(5000); //delay for 1sec
lcd.clear(); //Delete the Display of Medicine after the buzzer
delay(1000); //Delay time for the lcd.clear function
flag4 = 0; // clear flag
delay(1000);
}
else {
digitalWrite(LED,LOW);
}


}


}
} //Final Closing Bracket for Void loop

14  Using Arduino / Displays / Re: problem interfacing LCD using I2C bus on: August 25, 2012, 04:40:46 am
i used the I2C scanner from herehttp://arduino.cc/playground/Main/I2cScanner, the scan suggests that device is connected at 0x38 but still i'm not getting any display on the LCD using this address?

Have a look in this folder: \Arduino-1.0\libraries\LiquidCristal_I2C\info
It has a nice picture called schematic_diagram. The examples in the library are based on this schematic.
One significant difference with the example you started off is the connection of E , RS and R/W to the PCF.

So, please wire your display as in the schematic and have another go. Forget about the backlight for now, just connect to Vcc and GND (with a resistor of course)
15  Using Arduino / Project Guidance / Re: Outputting a voltage on: August 23, 2012, 11:35:20 am
Hi,

I just wanted to know if it's faisable with a arduino, and especially with a arduino BT board to outputting a voltage between 0v and 5v.

For example the number 100 corresponds to 0V and 345 corresponds to 5V.

Thank you

You could map it, and then use PWM.
Something like this:
int x = NumberToOutput; //replace with your value
int y = map(x, 100, 345, 0, 255);//  map 100 - 345 to 0 - 255
analogWrite(PWMpin, y); // write value to your (PWM-capable) output pin
Pages: [1] 2 3