https://makecode.microbit.org/13736-44103-16337-29335
This example shows how to use the .value
attribute. Note that it is not a function and so does not use paranethseses. Here pir.value
is treated in the same way as you would a variable.
from gpiozero import MotionSensor
from time import sleep
pir = MotionSensor(12)
Find folders without main.py files
find Izzy -mindepth 1 -maxdepth 1 -type d '!' -exec test -e "{}/main.py" ';' -print
A simple way to visualise the path of the ISS while your experiment was running is to plot your photos on a map. You can use a free software application on the Raspberry Pi to do this easily and quickly.
Note: In order for this to work, you should have embedded into the EXIF meta-data of your photo the latitiude and longitude of the ISS at the time the image was captured (this process was described in this section of the Phase 2 guide).
If you saved your latitude/longitude into a CSV file but did not embed the data into the appropriate EXIF fields then you could write some code to do this now.
You can use another analog device - a Light Dependent Resisitor (LDR) - to meausure how bright it is (light intensity). As you can probably guess from its name. the resistance of an LDR changes depending on how much light falls on it. By making a voltage divider with another resistor, you can measure a voltage that will change depending on how bright it is.
You can then use an array of LEDs to create a visual indicator of light intensity. As the light level increases, the number of LEDs that are on will also increase. Don't foget every LED needs a current-limiting resistor. To make building the circuit easier you can use a resistor array that has a number of resistors linked togther with a common pin.
const int analogPin = A0; // the pin that the LDR is attached to
from gpiozero import TonalBuzzer
from gpiozero.tones import Tone
from time import sleep
t = TonalBuzzer(21) # change to whatever pin the buzzer is connected
v1 = ["G4", "G4", "G4", "D4", "E4", "E4", "D4"]
v2 = ["B4", "B4", "A4", "A4", "G4"]
v3 = ["D4", "G4", "G4", "G4", "D4", "E4", "E4", "D4"]
The rain sensor detects water that falls on the metal circuit strips on its sensor boards. The sensor board acts as a variable resistor that will change from 100k ohms when wet to 2M ohms when dry. This change in resistence will cause a change in the outout voltage, which we can read using an anlog pin on the Arduino. There is also a digital pin which is pulled HIGH when the resistence falls below a threshold value set by the sensitivity dial (which is another variable resistor)
int RainPin = 0;
int RainDigitalPin = 2;
from gpiozero.pins.pigpio import PiGPIOFactory
from gpiozero import DistanceSensor
pigpio = PiGPIOFactory()
ds = DistanceSensor(14,15, max_distance=200, pin_factory=pigpio)
or
- Get a usb drive. At least 8GB
- Format the drive as a FAT32 single partition with a MBR
-
Insert USB drive into Desktop Raspbian laptop. Copy the iso for Desktop Raspbian onto this machine.
-
Install gparted onto the laptop:
sudo apt install gparted