I spent an hour digging through the Python files on the Duo. Tried a LED blink example (with some minor changes so it should work, maybe). It prints to the screen, but does not toggle the pin. Does pinpong work on Milk-V Duo yet? Maybe I’m doing it wrong. The docs are very thin, and of course there’s no mention of the Duo. There is a milkv-Duo sub-directory in examples, but not many hints to be found there.
Here’s my code:
import time
from pinpong.board import Board,Pin
Board("MILKV-DUO").begin()
led = Pin(Pin.D1, Pin.OUT)
while True:
led.write_digital(1)
print("1")
time.sleep(1)
led.write_digital(0)
print("0")
time.sleep(1)
I went back to this today and poked around some more. I realized that last time I had rather foolishly assumed that since GP1 is called GP1 in the pinout picture that the pin would be pinmuxed to GP1. But of course it isn’t. On bootup it’s pinmuxed to IIC0_SDA.
I changed that and now my blinky program works just fine. So now I can do some things in Python as well as C.
Here is the demo program after a couple small changes:
import time
from pinpong.board import Board,Pin
Board("MILKV-DUO").begin()
led = Pin(Pin.D1, Pin.OUT)
while True:
led.value(1)
# print("1")
time.sleep(0.1)
led.value(0)
# print("0")
time.sleep(0.1)
Oh ya, if you’re looking for the PinPong example files they’re at /usr/lib/python3.9/site-packages/pinpong/examples/milkv-Duo. I immediately copied the directory to a MUCH shallower place in the file system. Way too much typing to get there.
I’ve been screwin around with PinPong for a while. I think that either I’m doing something wrong or they started the port, but didn’t finish. I was trying to drive the Sharp Memory LCD using SPI.
Had fun learning to use the vi editor. I know people love vi and vim, but without a lot of practice to get habits built, it’s pretty clumsy. I could see it being good if you kept at it until you got it all memorized.
I could not get PinPong hardware SPI to work. I worked hard at it, and tried everything I could think of. No go.
So I wrote some simple code to bitbang SPI. But it was painfully slow. Unuseable.