Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
The RP2350-LCD-0.96 is a low-cost, high-performance microcontroller development board designed by Waveshare with flexible digital interfaces. In terms of hardware, it uses the RP2350A microcontroller chip officially developed by Raspberry Pi, equipped with a dual-core ARM Cortex-M33 processor and a dual-core Hazard 3 RISC-V processor, with a running frequency of up to 150MHz, built-in 520KB SRAM and 4MB memory, and up to 26 multi-function GPIO pins, a 0.96-inch LCD screen, and a battery interface, which is convenient for use in mobile applications. Its power IC TPS63000 is a high-efficiency DCDC buck-boost chip with a charge current up to 1A and a 1.8A current switch. For software development, either Raspberry Pi's C/C++ SDK, or the MicroPython is available, and there are complete development materials and tutorials, which makes it easy for you to get started, and integrate it into end products quickly.
Download the Demo to your computer desktop to conduct some interesting experiments.
led_external = machine.Pin(15, machine.Pin.OUT) #Set GP15 to output mode while True: led_external.toggle() #Change the state of the LED light every 5 seconds utime.sleep(5)
def button_reader_thread(): #Detect if a button is pressed global button_pressed while True: if button.value() == 1: button_pressed = True _thread.start_new_thread(button_reader_thread, ()) #Use the thread to detect keystrokes while True: if button_pressed == True: #If the button is pressed, the red light lights up and the buzzer alarms led_red.value(1) for i in range(10): buzzer.value(1) utime.sleep(0.2) buzzer.value(0) utime.sleep(0.2) global button_pressed button_pressed = False led_red.value(1) #In normal circumstances, when the light turns from red to green, the yellow light will be on for two seconds, then the yellow light and red light will go off, and the green light will be on utime.sleep(5) #When the light turns from green to red, the green light goes off first, the yellow light is on for two seconds, and then the red light is on led_amber.value(1) utime.sleep(2) led_red.value(0) led_amber.value(0) led_green.value(1) utime.sleep(5) led_green.value(0) led_amber.value(1) utime.sleep(5) led_amber.value(0)
Precautions for use: The middle pin of the Passive infrared sensor is the data output pin, and the pins on both sides can be connected to VCC and GND respectively.
def pir_handler(pin): #Interrupt handling function, the buzzer sounds, the LED rapidly flashes print("ALARM! Motion detected!") for i in range(50): led.toggle() buzzer.toggle() utime.sleep_ms(100) sensor_pir.irq(trigger=machine.Pin.IRQ_RISING, handler=pir_handler) #Turn on the interrupt, and when the human sensor detects an exception, it will enter the interrupt handling function for processing while True: #If there is no exception, the state of LDE will be changed every 5 seconds led.toggle() utime.sleep(5)
Precautions for use: The middle pin of the Potentiometer is the data output pin, and the pins on both sides can be connected to VCC and GND respectively.
potentiometer = machine.ADC(26) #Use GP26 as the analog signal collection pin conversion_factor = 3.3 / (65535) while True: voltage = potentiometer.read_u16() * conversion_factor #Format the collected data and convert it into a voltage value print(voltage) #Print the voltage information, the voltage value will change as the sliding varistor rotates utime.sleep(2)
#This code uses the state machine mechanism, the following code is a decorator, in which we can initialize the hardware, set the level of the pins, etc. #label("bitloop") We can define labels in the code to facilitate our execution by jumping to them. #jmp(not_x,"do_zero") When x=0, we adjust to the label "do_zero". #nop() .set(0) [T2 - 1] When x=0, it will jump here to execute. @asm_pio(sideset_init=PIO.OUT_LOW, out_shiftdir=PIO.SHIFT_LEFT, autopull=True, pull_thresh=24) def ws2812(): T1 = 2 T2 = 5 T3 = 1 label("bitloop") out(x, 1) .side(0) [T3 - 1] jmp(not_x, "do_zero") .side(1) [T1 - 1] jmp("bitloop") .side(1) [T2 - 1] label("do_zero") nop() .side(0) [T2 - 1]
# Create the StateMachine with the ws2812 program, outputting on Pin(22). sm = StateMachine(0, ws2812, freq=8000000, sideset_base=Pin(0)) #Create a state machine # Start the StateMachine, it will wait for data on its FIFO. sm.active(1) #Start state machine # Display a pattern on the LEDs via an array of LED RGB values. ar = array.array("I", [0 for _ in range(NUM_LEDS)]) print(ar) print("blue") for j in range(0, 255): for i in range(NUM_LEDS): ar[i] = j sm.put(ar,8) The method of #put() is to put the data into the output FIFO of the state machine time.sleep_ms(5)
Choose_Color.py
#Define color rgb9 = (0,255,0) #Green lcd.setCursor(0, 0) #Set cursor position # print the number of seconds since reset: lcd.printout("Waveshare") #Write characters lcd.setCursor(0, 1) #Set the cursor position to the second row and the zero column lcd.printout("Hello,World!") #Write characters lcd.setRGB(rgb1[0],rgb1[1],rgb1[2]); #Set the backlight
Discoloration.py
t=0 while True: r = int((abs(math.sin(3.14*t/180)))*255); #RGB changes over time g = int((abs(math.sin(3.14*(t+60)/180)))*255); b = int((abs(math.sin(3.14*(t+120)/180)))*255); t = t + 3; lcd.setRGB(r,g,b); #Reset the RGB value # set the cursor to column 0, line 1 lcd.setCursor(0, 0) #Navigate to the first row and the zero column # print the number of seconds since reset: lcd.printout("Waveshare") #Write characters lcd.setCursor(0, 1) #Navigate to the second row and the zero column lcd.printout("Hello,World!") #Write characters time.sleep(0.3)
No, you need to use a battery with an integrated protection circuit or connect an external protection circuit to prevent deep discharging.
Monday-Friday (9:30-6:30) Saturday (9:30-5:30)
Email: services01@spotpear.com