Raspberry Pi Python Challenges

Some of these challenges will only involve writing python program, while others require building circuits as well. Difficulty level: Easy. Write a program that gets a string as input and prints the length of the string. Refer to https://w3cloud.com/academy/lesson-2/...

Lesson 5

In the previous lesson, you leaned about building a LED circuit and controlling it from your python code. We even made the LED blink. Python Functions You can build your own functions and call it from multiple places. Breaking down into functions, improve the...

lesson 4

Connecting LED   Turn on a LED import RPi.GPIO as GPIO import time ledPin=40 GPIO.setmode(GPIO.BOARD) GPIO.setup(ledPin, GPIO.OUT) GPIO.output(ledPin, GPIO.HIGH) time.sleep(5) GPIO.output(ledPin, GPIO.LOW) GPIO.cleanup() Blink an LED 20 times import RPi.GPIO as...

Lesson 3

List As the name suggests, a list stores a collection of similar data types. List allow duplicate values. fruits = ['orange', 'apple', 'pear', 'apple', 'banana'] #adds 'kiwi' to the end of the list fruits.append('kiwi') print(fruits) print(len(fruits)) #prints 6 which...

Raspberry Pi: Change host name

You can change your Raspberry Pi’s host name. Your host name is referenced in two raspbian configuration files. Open up the terminal window. After you make these changes, reboot your raspberry pi. The following file will the default host name pi. Change it to...