Installed Micropython ARDUINO_GIGA-20240222-v1.22.2.dfu
Installed Arduino Lab for Micropython
Installed a USB thumb drive and formatted it FAT
Read and write to a text file on the USB flash. The USB thumb drive shows up as drive F: in Windows 11. The file writes to the USB.
file = open("test.txt", "w+") x = 0 while x < 11: str_x = str(x) print(str_x) file.write(str_x) x = x + 1 file.close() print(" ") fileToRead = open("test.txt", "r") while True: content = fileToRead.readline() if not content: break; print(content)
>
Wifi connection and NTP from time server. variables.py contains the SSID and password for the wifi. I am in the Eastern US for -4.
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")
I can blink the RBG on-board LEDs
from pyb import LED led_red = LED(1) led_green = LED(2) led_blue = LED(3) led_red.on() time.sleep(1) led_red.off() time.sleep(1) led_green.on() time.sleep(1) led_green.off() time.sleep(1) led_blue.on() time.sleep(1) led_blue.off()
I have been all over Arduino.cc to find the Giga Micropython pinout and how to write to the GPIO pins. I found the pin out chart. I wanted to try a simple sketch using pin 53 (GPIO DG7) according to the chart. Not even Top Tech Boy has anything on Giga R1 Wifi Micropython GPIO.
@scsiraidguru I was not aware that the pinout was different for Python. I thought pinout was a hardware feature.
Writing to GPIO pins is the same as it's always been.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@scsiraidguru I found a few links that may interest you. NOTE: one page may have numerous links, so use lots of tabs and follow everything. Meanwhile here is one you were asking about I think MicroPyhon GPIO
Here is the starter page for general info, NOTE it links to many other pages. Start Here
Micropython starts HERE
I looked at a lot more interesting pages, but since I have no interest in Python I didn't note them.
I made a very good living by the fact that I could read manuals and many many of my peers did not bother to read the manuals, I got promoted over them time and again.
I know Arduino documentation can be a problem, it's poorly organized in some places and well organized in others.
Good luck.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
the c code for the micropython Arduino GIGA port is here:
https://github.com/micropython/micropython/tree/master/ports/stm32/boards/ARDUINO_GIGA
Not that I think you want to wade through all that 😎 , but the is a pins.csv file that may be of interest.
Normally you would use the gpio pins in the following way: mypin = Pin("PA2", Pin.Out) etc.
I'm not familiar with the GIGA so I cant advise further, but any questions may be more productively put on the micropython github discussions forum https://github.com/orgs/micropython/discussions
@byron Or, he could just goto the link I gave him.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@byron I tried using from machine import Pin and setting it to Pin("DG7", Pin.OUT). it states DG7 wasn't available or something similar.
@zander It is the lack of organization that make Arduino.cc bad. Even Google can't find anything. I have done enough python over the years to know how to find information. Micropython on Giga is supposed to follow Portenta H7 methods. I wonder if micropython 1.22 is still incomplete?
I am still working on getting both Micropython on M7 and Arduino on M4 processor to co-exist. The Giga is still in its infancy.
@zander I follow these pages to install micropython with DFU-Util. I installed the latest version 1.22. The nice thing is the USB thumb drive, wifi, and NTP are available. For some reason, they soldered the RTC, ground and reset pins shut. I need to unsolder them to connect the battery for the RTC.
Once I get the pins working, I want to play with the 3 IRQs. I picked up a I2C temperature and humidity sensor.
@zander When I went to get my B.EE from University of Detroit/Mercy. We spent hours in the lab reading manuals on every possible component and how to use them. I have used over 35 sensors with my Arduinos. I have many I2C sensors that I use because of the ease of connecting them. The problem is Arduino doesn't do a great job on writing manuals for all their devices. I wish they would set them up the same from the Nano to the Giga all have different pin outs and names.
@byron I tried using from machine import Pin and setting it to Pin("DG7", Pin.OUT). it states DG7 wasn't available or something similar.
There is no pin name 'DG7' in the pins.csv I gave a link to. Try one of the pin names from the list and hopefully you will at least not get an error message. Working out what pin names link to what physical pin may be another hurdle, but try the name associated with number 53 on the list "PD4" and see if that works..
@zander I follow these pages to install micropython with DFU-Util. I installed the latest version 1.22. The nice thing is the USB thumb drive, wifi, and NTP are available. For some reason, they soldered the RTC, ground and reset pins shut. I need to unsolder them to connect the battery for the RTC.
Once I get the pins working, I want to play with the 3 IRQs. I picked up a I2C temperature and humidity sensor.
Since the MEGA has 6 interrupts, I doubt the GIGA has less, I would assume the same or more but after a few minutes searching can't find the info. If you find it let us know.
There is a dedicated pin for the RTC battery. See pic
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@zander When I went to get my B.EE from University of Detroit/Mercy. We spent hours in the lab reading manuals on every possible component and how to use them. I have used over 35 sensors with my Arduinos. I have many I2C sensors that I use because of the ease of connecting them. The problem is Arduino doesn't do a great job on writing manuals for all their devices. I wish they would set them up the same from the Nano to the Giga all have different pin outs and names.
Agreed re Arduino documentation. The best manuals are not even on the Arduino.cc site, they have their own domains yes, plural as there are two sets, I think one is more detailed but it's been a while since I was over there. IIRC, one of them has 'readthedocs' as part of the domain name.
BTW, I just noticed that on the GIGA you must set pinmode AFTER attachInterrupt, not before as was allowed before.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@byron @scsiraidguru I already gave the link twice. Here it is again. First a link, then a partial pic
https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-micropython/#pin-map
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@byron @scsiraidguru I already gave the link twice. Here it is again. First a link, then a partial pic
https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-micropython/#pin-map
Third time lucky then 😀, which means you beat a broken clock which is only right twice a day. 😎
@byron Don't you mean you and @scsiraidguru ? I was right the first time.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.