You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut apa102 = APA102::new()?;// Sets color for all LED.
apa102.set_all(255,0,0,0.5);// Sets color for first LED.
apa102.set_pixel(0,0,255,0,0.5);// Shows on the device.
apa102.show()?;
Lights
letmut lights = Lights::new()?;// Turn on red and green lights
lights.rgb(true,true,false);// Turn off red light
lights.red.off()// Turn on blue light
lights.blue.on()// Toggle green light
lights.green.toggle()
Buttons
letmut buttons = Buttons::new()?;// Identify if button A is pressedif buttons.a.is_pressed(){println!("Button A touched!");}
Display
letmut alphanum = Alphanum4::new()?;// Print a message on the display
alphanum.print_str("1234",false);
alphanum.show()?;
Buzzer
letmut buzzer = Buzzer::new()?;// Play a note
buzzer.midi_note(69,0.3)?;
Caution
Always be careful when working with the Raspberry Pi's peripherals, especially if you attach any external components to the GPIO pins. Improper use can lead to permanent damage.
Copyright and license
Copyright (c) 2020 Yann Nicolas. Released under the MIT license.