We've stored our entire Astro-Pi project including the results up on Github so these steps will detail how to pull them down onto your Pi.
First, create a folder to work with the code:
mkdir results
time | lat | long | photo | lux | |
---|---|---|---|---|---|
2018-01-26-22-06-35 | 98 | 75 | photoloc | 199 | |
2018-01-26-22-06-40 | 14 | 90 | photoloc | 211 | |
2018-01-26-22-06-45 | 70 | 37 | photoloc | 59 | |
2018-01-26-22-06-50 | 73 | 75 | photoloc | 82 | |
2018-01-26-22-06-55 | 11 | 95 | photoloc | 219 | |
2018-01-26-22-07-00 | 12 | 61 | photoloc | 145 | |
2018-01-26-22-07-05 | 12 | 91 | photoloc | 274 | |
2018-01-26-22-07-10 | 39 | 49 | photoloc | 72 | |
2018-01-26-22-07-15 | 46 | 75 | photoloc | 199 |
import csv | |
from time import sleep | |
with open('/home/pi/results.csv') as csvfile: | |
fieldnames = ['time', 'lat', 'long', 'photo', 'lux'] # Same fields we wrote to the file | |
reader = csv.DictReader(csvfile, fieldnames=fieldnames) | |
next(reader) # this lets us skip the header row | |
for row in reader: | |
print(row['lux']) # here we are just interested in the lux column |
import csv | |
import datetime as dt | |
from random import randint | |
from time import sleep | |
time_format = "%Y-%m-%d-%H-%M-%S" | |
with open('/home/pi/results.csv', 'w') as csvfile: # open the file for writing | |
fieldnames = ['time', 'lat', 'long', 'photo', 'lux'] # the different elements we store in each row | |
writer = csv.DictWriter(csvfile, fieldnames=fieldnames) # create writer with fields |
import io | |
import time | |
import picamera | |
from PIL import Image | |
from PIL import ImageStat | |
stream = io.BytesIO() | |
with picamera.PiCamera() as camera: | |
camera.start_preview() | |
time.sleep(2) |
import ephem | |
import time | |
iss = ephem.readtle("ISS (ZARYA)", | |
"1 25544U 98067A 17317.62840120 .00004117 00000-0 69389-4 0 9994", | |
"2 25544 51.6432 13.3344 0004461 113.6331 45.1344 15.54138509 84996") | |
while True: | |
iss.compute(ephem.now()) | |
print("Current position: %s, %s In darkness: %s" % (iss.sublat / ephem.degree, iss.sublong / ephem.degree, iss.eclipsed)) |
from sense_hat import SenseHat | |
from time import sleep | |
sense = SenseHat() | |
sense.set_rotation(270) | |
sense.show_message("Hello from Coderdojo Banbridge!", 0.05) | |
r = (255,0,0) | |
g = (0,255,0) |
from mcpi.minecraft import Minecraft | |
from time import sleep | |
from gpiozero import RGBLED | |
mc = Minecraft.create() | |
rgbled = RGBLED(26,19,13) | |
# block | |
grass = 2 | |
ice = 9 |
from mcpi.minecraft import Minecraft | |
from time import sleep | |
from gpiozero import LED, Button | |
mc = Minecraft.create() | |
led = LED(4) | |
button = Button(25) | |
start = mc.player.getTilePos() | |
while True: |
from mcpi.minecraft import Minecraft | |
from gpiozero import LED | |
mc = Minecraft.create() | |
led = LED(4) | |
# blocks | |
redstone_ore = 73 | |
while True: |