I installed Micropython 1.22 on my Giga R1 Wifi. I can get the Wifi working, NTP working and Read/Write to a text file. I found the pin out map. Where can I find information and examples to start building with it?
Hi,
You haven't to buid with upython...
You have just to send commands and observe the result...
A lots of examples on micropython.org/documentation or something like this.
The pin map is on the micropython's github page of the board...
A simple example:
from pyb import LED
from time import sleep
R, G, B = LED(1), LED(2), LED(3)
for i in range(10):
R.toggle()
sleep(1)
G.toggle()
sleep(1)
B.toggle()
sleep(1)
If you save it as "main.py", the board use it at the boot... Or you can use a software (screen, pyboard-rshell for example) and have a repl session where you can enter directly yours commands and see the result immediatly. You "talk" with your board...
Hello can you share the information about Wifi and NTP. I am looking for sample code in this area.
I will try to help you tonight
thank you
variables.py: I use this file to set wifi username.
username = "xxxxx" #SSID
spw = "yyyyy" #password
# PINOUT
D52 = "PK2"
D53 = "PG7"
# I2C
D20 = "PB11"
D21 = "PH4"
set_wifi_ntp.py
from machine import RTC
import network, ntptime, time, variables
WIFI_NETWORK = variables.username
WIFI_PASSWORD = variables.spw
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(WIFI_NETWORK, WIFI_PASSWORD)
print()
print("Connected to ",WIFI_NETWORK)
print(wlan)
rtc = RTC()
ntptime.settime()
(year, month, day, weekday, hours, minutes, seconds, subseconds) = rtc.datetime()
sec = ntptime.time()
timezone_hour = -4
timezone_sec = timezone_hour * 3600
sec = int(sec + timezone_sec)
(year, month, day, hours, minutes, seconds, weekday, yearday) = time.localtime(sec)
print("EDST Time: ")
print("Date: {}/{}/{}".format(month, day, year))
if (hours > 12):
pm_hours = hours - 12
print("Time: {}:{}".format(pm_hours, minutes), "pm")
if (hours < 12):
print("Time: {}:{}".format(hours, minutes), "am")
if (hours == 12):
print("Time: {}:{}".format(hours, minutes), "pm")