Change the depth of the top menu in the header php file:
‘primary’, ‘menu_class’ => ‘nav-menu’, ‘depth’ => ‘2’ ) ); ?>
Add submenus with the Advanced Sidebar Menu.
Change the depth of the top menu in the header php file:
‘primary’, ‘menu_class’ => ‘nav-menu’, ‘depth’ => ‘2’ ) ); ?>
Add submenus with the Advanced Sidebar Menu.
I wanted to control a seven segment display but still have enough pins left to work my ultrasonic distance sensor. The next step was to make my quad display work. I carefully worked through what each pin did using a spreadsheet and found I could display any number I liked at any one time, but they would all show the same number. Clearly the display needed to be refreshed in sequence somehow. My eureka moment was realising that this is exactly how it works – you just switch them on and off, one after the other really really fast. The eye can’t tell this is happening so you see it all as one display. PENNY D….R….O….P….S.
I found Pial’s Blog about using a shift register to control a 4 segment display and after much fiddling got it to work once I realised that his display worked on common anode (having a voltage made it work) whereas mine was common cathode (no voltage makes things work). I realised I had to make everything down where his was up and up where his was down. I then got a beautiful negative display of the numbers (the segments I wanted off were on and visa versa) which confused me for a while. I’d spotted a weird tilde ~ on the start of some variables and after a little research found that this made the binary numbers the “negative” (01000100 becoming 10111011). I removed the ~ and bingo, I could control the numbers. I found a minor bug in his digits too – his 5 made a 3 so I fixed that.
This code just prints random numbers at a fast flicker to prove I can change things on the fly.
/*
Shift Register Example
for 74HC595 shift register
This sketch turns reads serial input and uses it to set the pins
of a 74HC595 shift register.
Hardware:
* 74HC595 shift register attached to pins 2, 3, and 4 of the Arduino,
as detailed below.
* LEDs attached to each of the outputs of the shift register
Created 22 May 2009
Created 23 Mar 2010
by Tom Igoe
*/
//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;
//http://www.pial.net/post/Arduino-controlling-a-4-digit-seven-segment-display.aspx
const int digitPins[4] = {2,3,4,5}; //pins to control the 4 common anode pins of the display
const byte digit[10] = //seven segment digit bits
{
B00111111, //0
B00000110, //1
B01011011, //2
B01001111, //3
B01100110, //4
B01101101, //5
B01111101, //6
B00000111, //7
B01111111, //8
B01101111 //9
};
int digitScan = 0; //to interate through the digits in the display
int digitBuffer[4] = {0}; // to?
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
for(int i=0;i < 4 br="" gt="" i="" nbsp=""> pinMode(digitPins[i],OUTPUT);
}
}
void loop() {
//if (Serial.available() > 0) {
// ASCII ‘0’ through ‘9’ characters are
// represented by the values 48 through 57.
// so if the user types a number from 0 through 9 in ASCII,
// you can subtract 48 to get the actual value:
//int bitsToSend = Serial.parseInt();
//Serial.println(“Wrote: ” + String(bitsToSend));
//drop the latch
//digitalWrite(latchPin, LOW);
// shift the bits out:
//shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);
// turn on the output so the LEDs can light up:
//digitalWrite(latchPin, HIGH);
//}
// wait for a bit
//delayMicroseconds(400);
delay(1000);
refreshDisplay();
}
// Going to change the display
void refreshDisplay()
{
// make all the display segments LOW
for(byte k=0;k < 4 br=”” k=””> {
digitalWrite(digitPins[k], HIGH);
}
// the numbers I am outputting, need to link to sensor next
digitBuffer[0] = random(0, 9);
digitBuffer[1] = random(0, 9);
digitBuffer[2] = random(0, 9);
digitBuffer[3] = random(0, 9);
// open the latch
digitalWrite(latchPin, LOW);
// clear all the pins
shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
// close the latch pin
digitalWrite(latchPin, HIGH);
// wait for a bit
delayMicroseconds(400);
// makes the right digit high
digitalWrite(digitPins[digitScan], LOW);
// open the latch
digitalWrite(latchPin, LOW);
if(digitScan==0) // 0 is the first character – I want 3.123m
{
// write the number with the dp
shiftOut(dataPin, clockPin, MSBFIRST, (digit[digitBuffer[digitScan]] | B10000000)); //inserting the dot
}
else
{
// write the number
shiftOut(dataPin, clockPin, MSBFIRST, digit[digitBuffer[digitScan]]);
}
digitalWrite(latchPin, HIGH);
digitScan++;
if(digitScan>3) digitScan=0;
}
Next step is to link up to the distance sensor, but I now need to make a bug hotel with youngest.
So, I am still playing with Arduino, and want to understand the shift register better. Notes as I go.
So, my dad’s Dell Inspiron 1210 (Mini 12) finally died after years of service. I had moved it from Ubuntu to Windows a few years ago, but now it was properly dead. Dad’s friend had diagnosed a dead hard disk. And after much work I decided I agreed, though the BIOS was behaving badly. I used Clonezilla to boot to DOS and refresh the BIOS, and this helped, but in the end it was the disk.
I dismantled the laptop using Dell’s own instructions and found a disk I’d not seen before, a ZIF (zero input force) 1.8″ drive. I’d never met ZIF before and had no clue how to release it. Eldest daughter suggested pull it out, so I did, but I later found on youtube that there is indeed a clamp you release.
Anyway, I tried a large variety of methods to make a functioning machine. I wanted it to boot of an SD card and bought a 16GB in town. But booting from USB or making an image on the SD card was endlessly frustrating.
In the end, I sought out (with wife’s help) an old USB DVD. This got me moving forward, and I finally got Mandriva installed, though the display looked awful. Ubuntu 10.10 then worked, and I then thought I would go the whole hog and go for the latest version of Ubuntu LTS (Long Term Support).
Installing was interesting. Booting from a USB gave me weird display issues, but booting from the DVD was fine. I installed to the SD card but the install failed at “install bootloader”. I figured all the files would be in place and I just needed to get a bootloader working. Thanks to it being an SD card it was easy to whack it in my main laptop. Much searching got grub installed , I just had to find where it was mounting (/media/
sudo grub-install –root-directory=/media/
This got the sd card in the 1210 to boot to the grub prompt. More searching found three commands to get it booting:
grub> linux (hd0,1)/vmlinuz root=/dev/sda1 grub> initrd (hd0,1)/initrd.img grub> boot
Then I was in and it booted fine – all the files were there. Sadly the display was a complete disaster, a known problem.
So ctrl+alt+f1 got me a command prompt to get grub working properly, which was as simple as:
sudo grub-install /dev/sda
sudo update-grub
Then I needed to work on the display issues (it was booting to a blank screen or half a screen of garbled nonsense, depending on its mood. Back to ctrl+alt+f1 (the dist-upgrade took a while)
sudo apt-get dist-upgrade # this takes a while
sudo shutdown now -r # this reboots
The last stage was to follow the Ubuntu wiki for the problematic Intel gma 500 graphics card.
sudo service lightdm restart
I was just following the wiki by now:
Ubuntu 12.04
With the default settings, Ubuntu 12.04 boots to either a black screen or or top half screen.There are several potential solutions: console=tty1, disable splash, or 915 ResolutionOption 1 – console=tty1
Perhaps the easiest method is to use “console=tty1” as a boot option.
gksudo gedit /etc/default/grubFind the following line: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”Add console=tty1 in between the quotes, the end result looking as follows
- GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash console=tty1″
save and exit, then update grub withsudo update-grub
And now it works perfectly and seems very smooth.
Please note that this is now obsolete – see
https://thomas.w-p.me.uk/blog/2013/10/adding-squeezelite-to-squeezboxserver-on-rpi/
For a better way. The below is left for reference.
========================================================
I tried this once, but fell down when I got to the spotify bit because I had the wrong version of debian. This post is just personal notes of how I progressed the second time.
sudo apt-get update && sudo apt-get dist-upgrade sudo apt-get install libjpeg8 libpng12-0 libgif4 libexif12 libswscale2 libavcodec53 wget http://downloads.slimdevices.com/LogitechMediaServer_v7.7.2/logitechmediaserver_7.7.2_all.debsudo dpkg -i logitechmediaserver_7.7.2_all.deb sudo service logitechmediaserver stopwget http://allthingspi.webspace.virginmedia.com/files/lms-rpi-raspbian.tar.gztar -zxvf lms-rpi-raspbian.tar.gz sudo mv arm-linux-gnueabihf-thread-multi-64int /usr/share/squeezeboxserver/CPAN/arch/5.14/ sudo mv libmediascan.so.0.0.0 libfaad.so.2.0.0 /usr/local/lib sudo mv /usr/share/squeezeboxserver/Bin/arm-linux/faad /usr/share/squeezeboxserver/Bin/arm-linux/faad.old sudo mv faad /usr/share/squeezeboxserver/Bin/arm-linux sudo ln -s /usr/local/lib/libmediascan.so.0.0.0 /usr/local/lib/libmediascan.so sudo ln -s /usr/local/lib/libmediascan.so.0.0.0 /usr/local/lib/libmediascan.so.0 sudo ln -s /usr/local/lib/libfaad.so.2.0.0 /usr/local/lib/libfaad.so sudo ln -s /usr/local/lib/libfaad.so.2.0.0 /usr/local/lib/libfaad.so.2 sudo ldconfigsudo mkdir /mnt/musicsudo nano /etc/fstab //192.168.0.6/music /mnt/music cifs username=user,password=xxxxxx,workgroup=HOME,users,auto,user_xattr 0 0(then CTRL-X followed by Y to save the file) apt-get install alsa-base /usr/local/sbin/ and it came up right away.