Sample CircuitPython Code¶
We will be using a CircuitPython microcontroller to control physical hardware. The following examples introduce basic embedded programming techniques.
- Introductory Examples - Raspberry Pi Pico
- Hobby Servo Examples - Raspberry Pi Pico
- Digital Input/Output Examples - Raspberry Pi Pico
- DC Motor Examples - Raspberry Pi Pico
- Analog Input/Output Examples - Raspberry Pi Pico
- Signal Processing Examples - CircuitPython
- Decision Tree Classifier - Raspberry Pi Pico
- Remote Connection Examples - CircuitPython
- Music and Rhythm Examples - CircuitPython
- Stepper Motor Examples - Raspberry Pi Pico
- Ultrasonic Ranger Examples - Raspberry Pi Pico
- NeoPixel LED Examples - Raspberry Pi Pico
- I2C Examples - Raspberry Pi Pico
- Numerical Examples - Raspberry Pi Pico
- Program Structure - CircuitPython
Sample Arduino Code¶
We sometimes also used Arduino microcontrollers. Arduino programs are called ‘sketches’. The following examples are used in the Arduino tutorials.
- Blink Arduino Sketch
- Fade Arduino Sketch
- SoftBlink1 Arduino Sketch
- SoftBlink2 Arduino Sketch
- ReadSwitchInput Arduino Sketch
- ReadAccelerometer Arduino Sketch
- SensorFade Arduino Sketch
- ReadSonar Arduino Sketch
- ServoSweep Arduino Sketch
- SoundDemo Arduino Sketch
- WheelDrive Arduino Sketch
- StepperSweep Arduino Sketch
- EventLoopDemo Arduino Sketch
- MusicSequenceDemo Arduino Sketch
- InputHysteresis Arduino Sketch
- InputMatcher1 Arduino Sketch
- InputMatcher2 Arduino Sketch
- InputMatcher3 Arduino Sketch
- OneInOneOutASCII Arduino Sketch
- WS2801LED Arduino Sketch
- Adafruit_PWM Arduino Sketch
- MPU6050_DMP6 Arduino Sketch
- PinballGame Arduino Sketch
- EventBusyBox Arduino Sketch
- CKS-Shield-1-Test Arduino Sketch
- RemoteStation Arduino Sketch
- RemoteUserInterface Arduino Sketch
- RockPaperScissors Arduino Sketch
- FilterDemos Arduino Sketch
- ClassifierDemo Arduino Sketch
- Lecture Sample Code
Sample Python Code¶
Most of our projects will use standalone Arduino sketches, but it possible to extend the systems using communication between an Arduino and a host computer over the USB serial port. The following Python programs run on the host computer in conjunction with an Arduino sketch to provide broader capabilities.