Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Setting Alarm Problem on: January 23, 2011, 05:52:53 am
I thought in a  different way without referencing to the alarm library and used a simple if-statement

Code:
  if (hour()== Hour &&  minute() == Minute)
   {
 
     EveningAlarm1();
   }
 

This is what i want , thanks for help and suggestions  smiley-grin
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: Setting Alarm Problem on: January 22, 2011, 04:41:17 pm
i want to enter the values of hours,minutes,seconds from a serial interface (vb) and set the alarm on the value received , but the function
 Alarm.alarmRepeat(Hour,Minute,Second,EveningAlarm);

doesnt work unless it had a constant time value specified from within the  arduino [glow]and again i need to send the value from a vb[/glow]

so I was wondering if there is a way to set the alarm in another way

note: I use
#include <Time.h>  
#include <TimeAlarms.h>
3  Forum 2005-2010 (read only) / Syntax & Programs / Setting Alarm Problem on: January 22, 2011, 01:59:45 pm
I want to set an alarm with a specified serially read time I've tried every thing i can ,I even created a new function inside the library but nothing get me there
I need Help

Code:
void loop() {
  
 digitalClockDisplay();
 Alarm.delay(1000);
    if (Serial.available()>0)
 {  
  
  char setString[TIME_SET_StrLen];
  int index = 0;
 char c = Serial.read();
 if( c != '[')
     return;  // first character must be opening square brackets
  do
  {
     c = Serial.read();
     if( isdigit(c))  // non numeric characters are discarded
       setString[index++] = c -'0'; // convert from ascii    
  }
  while (c != ']'); // wait for trailing square brackets

 int count = index;
  int element = 0;
  for( index = 0; index < count; index += 2)  // step through each pair of digits
  {
      int val = setString[index] * 10 + setString[index+1] ; // get the numeric value of the next pair of numbers
switch( element++){
        case  0 :  Hour = val; break;
        case  1 :  Minute = val; break;
        case  2 :  Second = val; break;
}  
} }  
  
 Serial.print(Hour );
  Serial.print(Minute);
   Serial.print(Second);
   Serial.println("go to school");
  
     Alarm.alarmRepeat(20,20,0, MorningAlarm);
      Alarm.alarmRepea(Hour,Minute,Second,EveningAlarm); // my new function it works fine but not with serial date
  
  }

the function on the library
Code:
AlarmID_t TimeAlarmsClass::alarmRepea(int H, int M, int S, OnTick_t onTickHandler){
     return create( AlarmHMS(H,M,S), onTickHandler, IS_ALARM, IS_REPEAT );
}
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Problem with analogRead() on: January 22, 2011, 03:53:44 pm
you must wait a little bit
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: read the clock value from my pc on: January 22, 2011, 12:22:56 pm
Now I solved the Problem on the vb i used
Code:
   Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim Expr1 = uDate(Now())
        TextBox1.Text = "T" & Expr1
    End Sub

and on arduino the TimeSerial sketch

6  Forum 2005-2010 (read only) / Syntax & Programs / Re: read the clock value from my pc on: January 22, 2011, 06:42:39 am
Thanks for responding
i made a mistake copying the code its
Code:
for (int i=1 ; i< 5; i++){

and I'll test as you said, with checking the serial port every time and post the result
7  Forum 2005-2010 (read only) / Syntax & Programs / read the clock value from my pc on: January 22, 2011, 04:57:05 am
I'm making a vb code that a user would choose a time and write it to arduino and it will store it and set it as its time,
i defined an array that send the time date parameters ,
then another array in arduino read them. but it doesnt work  the variable types are wrong
Any Help Please or another possible way to do this

the arduino code
Code:
 
#include <Time.h>
#include <TimeAlarms.h>
int time[6];


 if (Serial.available())
 {  
   for (int i=1 ;i< 6; i++){
   time[i] = Serial.read();}
      setTime(time[2],time[1],0,time[3],time[4],11);}  // set time to ?:?:00 ? ? 2011
  }

vb2008 code

Code:
Dim dime(6) As Integer
  Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    
      dime(1) = Format(Now, "mm")
        dime(2) = Format(Now, "hh")
        dime(3) = Format(Now, "dd")
        dime(4) = Format(Now, "MM")
        
        For i = 1 To 4
            myport.WriteLine(dime(i))
        Next
End Sub


8  Forum 2005-2010 (read only) / Development / Re: Time Library added to Playground on: January 22, 2011, 08:27:13 am
After reading more of the previous posts i understood the NewTimeSerial.pde
 code , and Thank you [size=12]mem[/size]  You are a great person,
now i will try to send the time from vb  ;D
9  Forum 2005-2010 (read only) / Development / Re: Time Library added to Playground on: January 22, 2011, 06:28:42 am
Whats the way to get the clock from the PC using vb 2008 through the serial port ? is there a simple function for that ? :-/
10  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino Duemilanove on: January 23, 2011, 06:29:40 am
Its been so long but i wanted to tell anyone who had this problem , that I connected the arduino to my Vista and it's been working very well.
11  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino Duemilanove on: November 16, 2010, 06:45:33 am

Thank you all
12  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino Duemilanove on: November 14, 2010, 12:43:51 pm
ok right after i connected the board the computer turned off and every time i turned it on i got a blue screen with a Physical memory dump error, i could reach my files but it kept restarting, So please any suggestion now i want to connect it to another lenovo laptop with vista operating system and not sure of doing it
13  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino Duemilanove on: November 13, 2010, 02:04:29 pm
i know its Innocent but how do i convince my PC that it is ?
14  Forum 2005-2010 (read only) / Troubleshooting / Arduino Duemilanove on: November 13, 2010, 12:57:44 pm
[size=14]Hello People
I recently brought Arduino [glow]Duemilanove[/glow] when i connected it to my windows 7 laptop , the system crashed and it behaves as if the Duemilanove was an attacking object, it didn't accept it .
now am afraid to connect it again after i fixed the PC.

I was very excited to use it, whats the problem and what shall I do ? :-/[/size]
15  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Possibly the cheapest Sound sensor/Sound trigger on: January 23, 2011, 05:26:43 pm
I like these things  8-)
Pages: [1] 2