Notifications
Clear all

Giga GPIO Micropython programming

41 Posts
3 Users
3 Likes
345 Views
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

Posted by: @zander

@byron Don't you mean you and @scsiraidguru ? I was right the first time.

Nope, you were ignored twice, and being right, but ignored, is not really much use at all.  You will have to learn to speak up a bit more. (no  perish the thought...  and even louder Ron would be quite unsettling 😣 

 

This post was modified 3 weeks ago by byron

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7010
 

@byron Sure, but his loss not mine.

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.


   
ReplyQuote
(@scsiraidguru)
Member
Joined: 1 month ago
Posts: 59
Topic starter  

@byron https://docs.arduino.cc/resources/pinouts/ABX00063-full-pinout.pdf

It lists D53 on the right side as PG7.  I probably had a typo.  I will try it again tonight to see if I mistyped it.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

Posted by: @scsiraidguru

@byron https://docs.arduino.cc/resources/pinouts/ABX00063-full-pinout.pdf

It lists D53 on the right side as PG7.  I probably had a typo.  I will try it again tonight to see if I mistyped it.

PG7 seems correct,  you have to mind your P's and D's 😎.  

A quick glance and the GIGA appears its on the same lines, though with different pin names and probably other on board stuff, as the pyboard stm32.   You've probably seen the micorpython docs and the section relating to the pyboards but here is a link in case.  

https://docs.micropython.org/en/latest/pyboard/quickref.html

Its a useful ref for using mp in general with some specific refs for some boards.  Nowt on the GIGA though and this is the first time I have really heard of anyone using mp on a GIGA.   But it does look to be an interesting board, so I hope to hear how you get along with it. 

 


   
ReplyQuote
(@scsiraidguru)
Member
Joined: 1 month ago
Posts: 59
Topic starter  

Thanks Ron and Byron, it is working.   I decided to see if I could set Pin_53 to "PG7".   

from time import sleep
from machine import Pin
# Pin_53 (Arduino) = PG7 (MicroPython)
Pin_53 = "PG7"
Red_LED = Pin(Pin_53, Pin.OUT)

for i in range(0, 10):
    Red_LED.on()
    sleep(1)
    Red_LED.off()
    sleep(1)

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7010
 

@scsiraidguru Excellent. You might want to get out your magnifying glass and have a look at the board markings. I think the included pic is from the end of the board. This is one pin and it is labelled  D53 and PG7. Not sure if all the affected pins are labelled like that to agree with the chart I supplied earlier. Also including the chart from the on-line documentation in case you want more info.

Screenshot 2024 04 08 at 12.28.33
Screenshot 2024 04 08 at 10.21.35

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.


   
ReplyQuote
(@scsiraidguru)
Member
Joined: 1 month ago
Posts: 59
Topic starter  

@zander Just 53.  It would have been nice if it listed both on the device, 53 is listed on the riser and board.  I put the pinout picture on my web site.   I moved Pin_53 = "PG7" to variables.py.

from time import sleep
from machine import Pin
import variables
# Pin_53 (Arduino) = PG7 (MicroPython)
Red_LED = Pin(Pin_53, Pin.OUT)
Red_LED.off()

for i in range(0, 10):
    Red_LED.on()
    sleep(1)
    Red_LED.off()
    sleep(1)

https://mc.scsiraidguru.com/index.php/arduino/giga-r1-wifi/giga_micropython/


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7010
 

@scsiraidguru I don't have a board so I can't see what is there, but here is a screen grab of the pin out diagram on the arduino.cc site. It's a LOT bigger, I just grabbed the end part of the board that seems to have a lot of the pins you were interested in.

Screenshot 2024 04 09 at 19.52.56

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.


   
ReplyQuote
(@scsiraidguru)
Member
Joined: 1 month ago
Posts: 59
Topic starter  

I started adding all the pinouts to my variables.py.   52, 53 so far.   I will add them as I use them.  This way I can just call Pin_XX.   

Going up to put our children to bed.   Thanks for the help.  


   
Ron reacted
ReplyQuote
(@scsiraidguru)
Member
Joined: 1 month ago
Posts: 59
Topic starter  

Here is the code that calls D52 and D53 from Giga R1 WIFI into MicroPython.   In blink.py, I call the pins from variables.py.   I would post the video, it is 21 MB.   I can upload it to my web site this weekend.  

variables.py

# PINOUT
Pin_52 = "PK2"
Pin_53 = "PG7"

blink.py

from time import sleep
from machine import Pin
import variables
# Pin_53 (Arduino) = PG7 (MicroPython)

Red_LED = Pin(variables.Pin_52, Pin.OUT)
Green_LED = Pin(variables.Pin_53, Pin.OUT)
Red_LED.on()
sleep(1)
Red_LED.off()
sleep(1)
Green_LED.on()
sleep(1)
Green_LED.off()
sleep(1)

 

 


   
ReplyQuote
(@scsiraidguru)
Member
Joined: 1 month ago
Posts: 59
Topic starter  

Everything runs from main.py.
variables
.py: contains the SSID information and I am starting to build the conversion from Arduino to Micropython.
Blink
.test.py: tests the pinouts by blinking two LEDs
ntp
_server.py: gets the NTP time from a server for the RTC clock
wifi
.py: connects to the ssid and gets a DHCP address.
I created classes and import them.

variable.py

# SSID
username = "xxxx"
spw = "xxxx"

# PINOUT
D52 = "PK2"
D53 = "PG7"

ntp_server.py

import ntptime, time
from machine import RTC


class RTCTime:
    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)
    


wifi.py

import network, variables

class WIFI:
    WIFI_NETWORK = variables.username
    WIFI_PASSWORD = variables.spw
    wlan = network.WLAN(network.STA_IF)
    wlan.active(True)
    wlan.connect(WIFI_NETWORK, WIFI_PASSWORD)

Blink_test.py

from time import sleep
from machine import Pin
import variables
# D53 (Arduino) = PG7 (MicroPython)


class Blynk:
    Red_LED = Pin(variables.D52, Pin.OUT)
    Green_LED = Pin(variables.D53, Pin.OUT)
    Red_LED.on()
    sleep(1)
    Red_LED.off()
    sleep(1)
    Green_LED.on()
    sleep(1)
    Green_LED.off()
    sleep(1)

main.py

from wifi import WIFI
from ntp_server import RTCTime
from blink_test import Blynk

a = WIFI()
print()
print("Connected to ",a.WIFI_NETWORK)
print(a.wlan)

b = RTCTime()
print("Date: {}/{}/{}".format(b.month, b.day, b.year))

if (b.hours > 12):
    pm_hours = b.hours - 12
    print("Time: {}:{}".format(pm_hours, b.minutes), "pm")


if (b.hours < 12):
    print("Time: {}:{}".format(hours, b.minutes), "am")


if (b.hours == 12):
    print("Time: {}:{}".format(hours, b.minutes), "pm")

Blynk()

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7010
 

@scsiraidguru Ok, and????

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.


   
ReplyQuote
(@scsiraidguru)
Member
Joined: 1 month ago
Posts: 59
Topic starter  

As an electrical engineer, we are not done till we post our final project notes.   

Considering the lack of Giga R1 Wifi Micropython examples and coding available across the internet including this site and Arduino.cc, I thought I would start adding projects and examples for other users.   My next module is I2C and SPI.   On Inventr.io, the site I help users with Arduino coding, I post the code to do many projects to help them learn.   I spent last night helping one of their newbies write an array for a lock/unlock program.  

Byron and you have been a great help so far.   Few have Giga boards and fewer use micropython with it.   

I did put in for Bill and his team to do a video on how to get the Giga to work with both micropython and arduino at the same time.   I would be great to get both working at the same time.  

I am working on I2C this morning in micropython.  I have done it with 15+ devices for Arduino connected together.   

I hope it helps other users.   

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7010
 

@scsiraidguru Ok, now I get it, I couldn't understand why you were posting stuff like that.

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.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7010
 

@scsiraidguru If you plan on publishing a tutorial, then you should start a new topic in this sub-forum, but maybe title it Tutorial on GIGA and/or MicroPython or two new Topics so folks that are interested can subscribe and those who are not can unsubscribe.

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.


   
ReplyQuote
Page 2 / 3