send an sms notification that has time and date within the message

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
KAG Tech0262
Posts: 10
Joined: Wed Aug 04, 2021 7:04 am

send an sms notification that has time and date within the message

Post by KAG Tech0262 » Wed Aug 11, 2021 9:38 am

we are working on sending an sms alarm notification using the raspberry pi pico and the sim800l gsm module on thonny micropython..we have managed to send an sms notification now what we are trying to do is to send an SMS notification that has real time and date within the message..weve seen on the forum that we need to set the rtc on the raspberry pi pico to our current time and ..it would be great if you would help us with that ...at the moment we found a program that prints out the correct time and date on the shell terminal.

Code: Select all

import utime
days = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']

for _ in range(5):
    (year,month,day,hour,minute,second,wday,yday)=utime.localtime(utime.time())    
    print("%d-%02d-%02d %02d:%02d:%02d %s, day %d of the year" %
         (year,month,day,hour,minute,second,str(days[wday]),yday))
    utime.sleep(1)
below are the results

Code: Select all

2021-08-11 10:11:06 Wed, day 223 of the year
2021-08-11 10:11:07 Wed, day 223 of the year
2021-08-11 10:11:08 Wed, day 223 of the year
2021-08-11 10:11:10 Wed, day 223 of the year
2021-08-11 10:11:11 Wed, day 223 of the year
your response and help will be highly appreciated.

Post Reply