Code problems with Adafruit Library

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
ellkaymaui
 
Posts: 15
Joined: Fri Mar 14, 2014 9:49 pm

Re: Code problems with Adafruit Library

Post by ellkaymaui »

OK, thanks. I saw that posted on one of the sites I visited but wasn't sure about using it. The find command results listed the Adafruit directory like this: ./Adafruit-Raspberry-Pi-Python-Codes. I believe that means that it's in the home directory for the username pi that I login under and that I can use the command straight from the $ prompt.

User avatar
ellkaymaui
 
Posts: 15
Joined: Fri Mar 14, 2014 9:49 pm

Re: Code problems with Adafruit Library

Post by ellkaymaui »

Okay, so I'm confused/lost. At the initial login I type this:

pi@raspberrypi ~ $ find
.

And the part of the results that mentions the directory I want to remove shows this:

./Adafruit-Raspberry-Pi-Python-Code
./Adafruit-Raspberry-Pi-Python-Code/Adafruit_VCNL4000
./Adafruit-Raspberry-Pi-Python-Code/Adafruit_VCNL4000/Adafruit_VCNL4000_example.py
./Adafruit-Raspberry-Pi-Python-Code/Adafruit_VCNL4000/Adafruit_VCNL4000.py
./Adafruit-Raspberry-Pi-Python-Code/Adafruit_VCNL4000/Adafruit_I2C.py
./Adafruit-Raspberry-Pi-Python-Code/Adafruit_TCS34725
./Adafruit-Raspberry-Pi-Python-Code/Adafruit_TCS34725/Adafruit_TCS34725.py
./Adafruit-Raspberry-Pi-Python-Code/Adafruit_TCS34725/Adafruit_TCS34725_Example.py

And a whole lot more. I don't know the meaning of the period before the / in the file path but obviously it has significance as typing the rm -rf /Adafruit-Raspberry-Pi-Python-Codes at the $ prompt doesn't appear to do anything. As I said at the beginning of this thread, I'm a complete neophyte. :roll:

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Code problems with Adafruit Library

Post by adafruit_support_mike »

You're right that "./Adafruit..." is different from "/Adafruit...".

"/" is called the "root directory" or "the base of the file tree". Every directory on the computer is contained in "/", and "/" isn't contained in any other directory. To navigate the file tree, you list the sequence of directories between "/" and the thing you want.

Such a list is called a "filepath". "/home/pi/file" means "if you start at the base of the file tree you should be able to find a directory named 'home'. Inside that you should be able to find a directory named 'pi'. Inside that you should be able to find a file named 'file'."

Filepaths that start from the root directory are called "absolute filepaths" because they always identify the same thing no matter where you are.

Over the years, Unix users have found a couple of other paths that tend to get used a lot, so they created shorthand references that make them easier to type.

"." is shorthand for "the working directory", which is another way of saying "where I am right now." "./subdir/file" is a quick way of saying, "starting from where I am right now, you should be able to find a directory named 'subdir'. Inside that you should be able to find a file named 'file'." That's convenient when you're working way deep in the file tree and the absolute paths look like "/usr/pkgsrc/graphics/tiff/work/tiff-4.0.2/contrib/dbs/xtiff/".

Filepaths that start from "./" are called "relative filepaths" because what you find depends on where you start.

"~" is shorthand for "my home directory". It's where you start every time you log in, and is where you keep most of your stuff. It's sort of halfway between an absolute filepath and a relative filepath. What you find doesn't depend on where you are, but on who you are. Every user has their own home directory, and each one will have their own "~/.profile". OTOH, "~/.profile" will always identify "my version of ~/.profile" no matter where you are in the file tree.

So.. saying `rm -rf /Adafruit...` means "go to the root of the file tree and delete everything in the directory named 'Adafruit..'". Saying `rm -rf ./Adafruit...` means "delete everything in the file named 'Adafruit...' which should be visible from where I am now."

You can always find where you are in the file tree using the command `pwd` (Print Working Directory). You can always return to your home directory using the command `cd ~`. You can always find the contents of the directory where you are now using the command `ls`.

User avatar
ellkaymaui
 
Posts: 15
Joined: Fri Mar 14, 2014 9:49 pm

Re: Code problems with Adafruit Library

Post by ellkaymaui »

Thank you for taking the time to provide the explanation, I'm going to copy it and keep it for reference and learning!

I successfully removed the corrupted code/directory and I've re installed a clean copy. Best news of all, my clock/thermometer kit is working like a charm :D

Many thanks for your patience and help :)

User avatar
ellkaymaui
 
Posts: 15
Joined: Fri Mar 14, 2014 9:49 pm

Re: Code problems with Adafruit Library

Post by ellkaymaui »

Okay, it didn't take me long to come up with another question. I've used the tzselect command to select my local timezone but I can't find information on how to send that time to the RTC unit and have local time on the display.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Code problems with Adafruit Library

Post by adafruit_support_mike »

Glad to hear you got things working.

Which RTC are you using?

User avatar
ellkaymaui
 
Posts: 15
Joined: Fri Mar 14, 2014 9:49 pm

Re: Code problems with Adafruit Library

Post by ellkaymaui »


User avatar
ellkaymaui
 
Posts: 15
Joined: Fri Mar 14, 2014 9:49 pm

Re: Code problems with Adafruit Library

Post by ellkaymaui »

Well an answer to my last question presented itself while I was running apt-get upgrade. I noticed a statement that said the system time could be changed to local time using dpkg-reconfigure tzdata. As soon as I completed the selection of my local timezone the time on the display changed! :D Happy me, happy day :D

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Code problems with Adafruit Library

Post by adafruit_support_mike »

That'll do it. ;-)

The RTC itself doesn't have a time zone setting. It just counts the time from whenever you told it to start. The OS knows how to handle time zones, the code knows how to ask for the right information, and now you know how to set everything up so it works.

Happy hacking!

User avatar
ellkaymaui
 
Posts: 15
Joined: Fri Mar 14, 2014 9:49 pm

Re: Code problems with Adafruit Library

Post by ellkaymaui »

Coming up on 36 hrs of continuous operation including unbroken WiFi connectivity. Feeling much more confident now about future possible projects, so much so that I ordered a 3 piece heat sink kit (even today here in Hawaii the temperature was 80F and the RPi was running at 105 - 110F) and a PiBow Rainbow case (after all, this is the Rainbow State). :D

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”