.@nickherbertmp please speak out against the government plans to change laws behind closed doors on the #EUwithdrawalbill
From my twitter post: Petition: Hold a referendum on the final Brexit deal https://t.co/ZpIiQFdSRs
Petition: Hold a referendum on the final Brexit deal https://t.co/ZpIiQFdSRs
Reskinning Max2play
Reskinning Max2play
Max2play is a great way to have an out of the box music server running on a Raspberry Pi with a touch screen. I’ve installed Max2play on a Raspberry Pi 3 and 7 inch touch screen. The only problem with it is that I would like to run other software on the Pi as well (such as control my Phillips Hue lighting). Out the box, the Pi now boots up and runs the full screen Jivelite app which controls the music. There are two options I could think of: 1. Write a plugin for Jivelite to control the Hue lights, or 2, control the lighting with a separate app and have the ability to launch jivelite manually. I went for 2 since Jivelite is written in Lua which I don’t know.
The first problem is how to launch Jivelite manually. For this I added a Jivelite icon to the desktop. I’m assuming Max2play is installed with Jivelite options and everything is working.
In the Jivelite plugin settings, disable autostart. In the Settings/Reboot tab, enable Autostart desktop (the desktop is normally started with the jivelite plugin so we need to enable it here).
In the Pi’s file manager go to Edit/Preferences – enable ‘Open files with Single click’ – it’s not easy double clicking with the touch screen. You might also want to increase the icon sizes whilst your there. These setting affect the desktop as well.
SSH into the Raspberry pi – either from the terminal or via the web plugin you can install. Go to the desktop folder and create a desktop launch shortcut. We will start by making one to launch jivelite. So create a text file with nano jivelite.desktop
and add
[Desktop Entry] Type=Application Icon=/home/pi/music.png <edit this to point to your own icon> Name=Jivelite Comment=Start the Jivelite music player Exec=/opt/jivelite/jivelite/bin/jivelite
Save the file and that’s it. You should be now be able to launch jivelite from the desktop icon. The quit button does not quit the application (it seems to stop the music), so you have to quit from the menu options on Jivelite. (There appears to be a patch file that creates this behavior but I’ll investigate that at a latter date.)
To autostart at login, make a symbolic link to the .desktop file and place it in ~/.config/autostart
You may want to disable the screensaver which blanks the screen after 10 minutes as is. Remove the @xscreensaver -no-splash line from /etc/xdg/lxsession/LXDE/autostart and from ~/.config/lxsession/LXDE/autostart Stopping the screensaver server has no effect. I’m not sure what causes the screen to blank when running the GUI. It might be power saving in X. To disable the screensaver, the easiest method is to install a screensaver client and configure that not to run.
sudo apt-get install xscreensaver
After that’s completed there will be a screensaver option in the LXDE GUI menu. Run that and disable the screensaver from there.
From my twitter post: I’ve signed the petition asking @theresa_may not to throw away our #HumanRights when we leave the EU. Can you too? https://t.co/7UGFKBTWWi
I’ve signed the petition asking @theresa_may not to throw away our #HumanRights when we leave the EU. Can you too? https://t.co/7UGFKBTWWi
Security guard robot ends it all by throwing itself into a watery grave | Ars Technica UK
From my twitter post: We need cross-party #BrexitNegotiations. Sign the petition if you agree: https://t.co/Z3HeXm2hGS https://t.co/TsUA5PzqmA via @38_degrees
We need cross-party #BrexitNegotiations. Sign the petition if you agree: https://t.co/Z3HeXm2hGS https://t.co/TsUA5PzqmA via @38_degrees
From my twitter post: Time to refit the optics lab courtesy of Oxfam https://t.co/bHtGwpW1Ip
Time to refit the optics lab courtesy of Oxfam https://t.co/bHtGwpW1Ip
Connecting an LED to a single board computer
Just a few notes on powering LEDs from single board computers. I’ve just started playing with an Adafruit Feather Huzzah which has just turned up with with a starting kit containing LEDs, switches, resistors and interestingly no wires – but I suppose I’ve got plenty of those around.
The Huzzah powered by an ESP8266 which is actually a wi-fi chip with a full TCP/IP stack and integrate mirco-controller that can be programmed via PlatformIO or the Arduino IDE. It’s only 80MHz but has 4Mb of flash, 9 GPIO pins and a single 1V max ADC. The chip is 3.3V and max current per GPIO is only 12mA.
Many of the GPIO are dual purposed. #0, #2, #15 and #16 are used for boot-mode detection and boot loading. I would avoid these unless really needed.
That leaves #4,#5,#12,#13.
In the starter kit there is a red LED (1.85-2.5V forward voltage, at 20mV current). The longer of the wires is the anode (+ve).
LEDs are current controlled devices so if you just wire them to voltage source (as in a GPIO pin) they will draw as much current as they can and either your LED or your source will go bang. We need to put a current limiting resistor in place and its value is given by
R=Vs−VfImaxSo worse case forward voltage is 1.85V and the max current is 12mA. This requires a resistor of 121 Ohms. So anything larger than this should be ok, the larger it is the dimmer the LED will be.
vim cheat-sheet
A minimal cheat-sheet to get by in vim (vi /gvim)
There’s no doubt that vim/vi or gvim is an incredibly powerful editor. it’s also very lightweight and fast, making it an ideal editor on the Raspberry Pi. It does however have a learning curve. This in a minimal cheat-sheet of commands. The ones in bold are I think the ones you need to learn to be able to use it at a basic level. Also try running vimtutor
from the command line for a tutorial.
Esc key – Normal mode
Inserting text
a -append
i – insert
o – open (inserts line below current line, O open above current line)
r – replace (replaces the character under the cursor with the next one entered,
R – replace mode (overwrite text until Esc pressed)
ce – change (deletes to end of word and then switches to insert mode) c$ deletes the rest of the line
Deleting text
x -delete character
dw – delete word (d2w delete two words)
de – delete from cursor to end of word
d$ – delete from cursor to end of line
dd – delete the line (2dd delete two lines)
Undo
u – undo
U – undo all changes on a line
Put, Past and Cut
p – put the contents of the buffer (paste) (this is the last thing deleted or yanked)
v – visual selections mode (highlights text for eg deletions or write to file with :w FILENAME)
y – yank (copies highlighted text), yw – yanks word
Moving about
gg – go to start of the file
GG – go to end of the file
504G – goto line 504
/ – search, n find next, N find previous
% – find matching bracket (,[,{
0 – move to start of the line, ^ move to first non space character.
$ – move to end of the line
Status
^G – file and position status
! – execute external command e.g. !ls
Writing and Reading
:w – save the file
:w FILENAME – save as FILENAME
:r FILENAME – inserts content of file here, you can also insert output of commands eg :r !ls
:q! -quit discarding changes
: x – quit saving changes (if there are any as opposed to :wq which always saves)