Posts

Showing posts from June, 2022

Worked best SD card with Thonny

 This code worked in Micro python with Pi Pico: (After a lot of problems.)  print(",,,xkchgvsdckhsgDigiKey0  ") print("core Electronics How to setgggg up Pi Pico and Code with Thonny") import machine import sdcard import uos import os # Assign chip select (CS) pin (and start it high) cs = machine.Pin(9, machine.Pin.OUT) # Intialize SPI peripheral (start with 1 MHz) Check it IS 1000000 spi = machine.SPI(1,                   baudrate=100000,                   polarity=0,                   phase=0,                   bits=8,                   firstbit=machine.SPI.MSB,                   sck=machine.Pin(10),                   mosi=machine.Pin(11),       ...

SD Card, Circuit Python via Thonny

Image
 Finally got Pi Pico to run simple SD card program with Thonny and Circuit Python using adafruit library. # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries PB1 try # SPDX-License-Identifier: MIT #Worked !! Sat Jun 25 15:20:38 NZST 2022 import os import busio import digitalio import board import storage import adafruit_sdcard # The SD_CS pin is the chip select line. # #     The Adalogger Featherwing with ESP8266 Feather, the SD CS pin is on board.D15 #     The Adalogger Featherwing with Atmel M0 Feather, it's on board.D10 #     The Adafruit Feather M0 Adalogger use board.SD_CS #     For the breakout boards use any pin that is not taken by SPI #SD_CS = board.SD_CS  # setup for M0 Adalogger; change as needed #block below from DoneBot workshop pb Some capitalisation changes MOSI = board.GP11 MISO = board.GP12 #clk = board.GP10 SCK = board.GP10 cs = board.GP15 # Connect to the card and mount the filesystem. sp...

Pi Pico OLED 1

Image
 Tue Jun 21 14:14:22 NZST 2022 + one day # Basic example of clearing and drawing pixels on a SSD1306 OLED display. # This example and library is meant to work with Adafruit CircuitPython API. # Import all board pins. #from board import SCL, SDA import busio # Import the SSD1306 module. import adafruit_ssd1306 import board # Create the I2C interface. #i2c = busio.I2C(board.SCL, board.SDA) i2c = busio.I2C(board.GP17, board.GP16) #i2c = busio.I2C(GP17,GP16) # Create the SSD1306 OLED class. # The first two parameters are the pixel width and pixel height.  Change these # to the right size for your display! display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c) # Alternatively you can change the I2C address of the device with an addr parameter: # display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31) # Clear the display.  Always call show after changing pixels to make the display # update visible! display.fill(0) display.show() # Set a pixel in the origin 0,0 position. d...
Image
 Now got Pico going via Adafruit's Circuit Python and Mu IDE. Code for flashing LED was: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # # SPDX-License-Identifier: MIT #Pb worked 16.6.22 """Example for Pico. Blinks the built-in LED.""" import time import board import digitalio led = digitalio.DigitalInOut(board.LED) led.direction = digitalio.Direction.OUTPUT x=1 while True:   # led.value = True     led.value = True     x=x+1     time.sleep(2.5)     print("1CEEFFBOnnnnmmx",x)     led.value = False     print("OFFFFx1")   #  time.sleep(0.1)     time.sleep(0.1) # Write your code here :-)
Image
  Got a new Pi Pico and it looks very promising. Want to use Oled display with it.  Tried out SSD1306 Oled display first on Arduino. This worked with code below. Then went and tried out Pi Pico for Hello World, blink etc. Here the Pico is going through the Arduino Oled display program. /**************************************************************************  This is an example for our Monochrome OLEDs based on SSD1306 drivers  Pick one up today in the adafruit shop!  ------> http://www.adafruit.com/category/63_98  This example is for a 128x32 pixel display using I2C to communicate  3 pins are required to interface (two I2C and one reset).  Adafruit invests time and resources providing this open  source code, please support Adafruit and open-source  hardware by purchasing products from Adafruit!  Written by Limor Fried/Ladyada for Adafruit Industries,  with contributions from the open source community.  BSD license, c...