Using an Arduino with Python LESSON 16: Connecting and Using a Joystick with Arduino

 

In this video lesson we are working towards creating a 3D version of the classic Pong arcade game. In this session, we show how to read data from the joystick using the arduino.

The arduino code developed in this video is included for your convenience below:

 

Also, this is the vPython 3D simulation we have developed thus far:

 

Using an Arduino with Python LESSON 15: Model of Bouncing Marble in 3D Room

In this video lesson we model a 3D room, and have a marble bouncing around in the room, off of each of the six walls. Below we include the code we develop in the video above

 

Using an Arduino with Python LESSON 14: Model a Moving Marble in a Room Using Parameters


In this lesson we show how to model a moving marble in vPython. We show how to create an animation where the marble bounces off the left and righty walls of our virtual room. For your convenience, we include the code below:

 

Understanding Raspberry Pi 4 GPIO Pinouts

Raspberry Pi GPIO Pinout
Diagram of physical and BCM Pins on Raspberry Pi

This shows the pinout for the Raspberry Pi 4. It shows both the BOARD numbering scheme, and the BCM numbering scheme. You define which numbering scheme you want to use in your python program. You must start by importing the GPIO Library:

import RPi.GPIO as GPIO

Then, if you use setmode to define which numbering scheme you want:

GPIO.setmode(GPIO.BOARD)

will give you the Physical Pin numbering scheme.

If you use:

GPIO.setmode(GPIO.BCM)

You will be using the BCM Numbering Scheme. I prefer the BOARD Scheme as it is  much easier to keep track of. Hope this helps.

Using an Arduino with Python LESSON 11: Controlling an LED from Python

In this video lesson, we show how to control an LED using python. Python sends commands to arduino, which then controls the LED. We also create a vPython visual, where the ‘Virtual’ LED mimics the behavior of the real LED. This a really cool demonstration and hope you enjoy it. I include below the code we develop in the video. On the arduino side we end up with the following:

And on the python side we have:

 

Making The World a Better Place One High Tech Project at a Time. Enjoy!