In this video lesson we present the solution to the homework assignment given in LESSON #6. Your assignment was to create a dimmable LED where the brightness of the RGB LED is controlled by the potentiometer. We are still using the schematic from our earlier project.
This is the circuit we will use moving forward in the class
In this lesson, this is the code which we came up with:
In this video lesson we will become familiar with the FUSION AI HAT+, and we will learn how to do digital inputs and outputs, analog in readings, analog outputs, PWM and how to control servos. By the end of the lesson you should have the essentials you need to work with the Fusion HAT+. The schematic for the circuit we will be using in today’s lesson if below. We describe it in more detail in the video. The schematic is:
This is the circuit we will use moving forward in the class
In the video lesson we demonstrated the following programs:
Digital output to blink an LED:
Python
1
2
3
4
5
6
7
8
9
10
fromfusion_hat.pin importPin,Mode
importtime
LEDPin=17
redLED=Pin(LEDPin,mode=Mode.OUT)
whileTrue:
redLED.high()
time.sleep(.1)
redLED.low()
time.sleep(.1)
PWM Example to Control RGB LED Color and Brightness.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from fusion_hat.pwm import PWM
from time import sleep
redPin=5
greenPin=6
bluePin=7
redLED=PWM(redPin)
greenLED=PWM(greenPin)
blueLED=PWM(bluePin)
redLED.freq(200)
greenLED.freq(200)
blueLED.freq(200)
whileTrue:
forbright inrange(0,101,1):
redLED.pulse_width_percent(bright)
sleep(0.01)
print(bright)
forbright inrange(99,0,-1):
redLED.pulse_width_percent(bright)
sleep(0.01)
print(bright)
Reading Analog Voltages on the Pi 5 Using the Fusion HAT+
In today’s lesson we will become familiar with the capabilities of the Fusion AI Hat+ for the Raspberry Pi. This hat will be a core part of our class moving forward. The hat makes it easy to get data from the outside world, and to control things in the outside would. We will get an understanding of the core capabilities of the board, and your homework will be to build the first circuit with the board. This schematic shows the various parts of the board:
Fusion AI Hat for Raspberry Pi Schematic
Then for the homework, we need you to go ahead and build this circuit. This circuit will allow us to learn how to make Digital Output commands, PWM commands, and how to read analog inputs.
This is the circuit we will use moving forward in the class
In this video lesson, I show you my solution to the Homework Assignment in LESSON #3. If you were not able to do the homework yourself, you can follow along in the video. Make sure you can do it on your own, without checking back to my solution. You need to understand these basics before moving on the class.
This is my homework solution.
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
whileTrue:
bucket=0
numGrades=int(input('How Many Grades do you Have: '))
grades=[]
foriinrange(numGrades):
grade=int(input('Enter Your '+str(i+1)+' Grade '))
This new class, AI on the Edge, will use Python as the primary programming language. If you are not familiar with python, this video lesson will teach the essentials in one go. Go through the video, and follow the examples. Practice the things in the video, and then do the homework. If you can learn these basics, you should be able to follow along with the balance of the class.
Making The World a Better Place One High Tech Project at a Time. Enjoy!
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok