My Astro Pi programs as sudo

Some functionality of Astro Pi is only avalaible as supersuser. This notebook must be run from root account (at your own risk!)

From the console set the root password:

$ sudo passwd

$ sudo aptitude install sux

and login as superuser with enabled graphics:

$ sux

Link and execute the script

# ln -s /home/pi/bin/notebook.sh /usr/local/bin

# ipython.sh

After this you can open this notebook from the browser of an external computer with the url: http://rapberry.pi.ip:8888

Temperature

WARNING: Your running as superuser!


In [4]:
from astro_pi import AstroPi
ap = AstroPi()
temp = ap.get_temperature()
print(round(temp,1))


31.0

In [3]:
from astro_pi import AstroPi
ap = AstroPi()
for i in range(100):
    temp = ap.get_temperature()
    temp=round(temp,1)
    ap.show_message("%g" %temp,  text_colour=(255, 255, 0), back_colour=(0, 0, 255))
    
ap.clear()

In [ ]:

Write temperature in the LED screen

Commit the changes from the terminal in the pi account with the command

$ git commit -am 'your message to describe the changes'