Beginner Needing Help Setting Up PiOLED

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
bar13aro
 
Posts: 3
Joined: Wed May 04, 2022 3:44 am

Beginner Needing Help Setting Up PiOLED

Post by bar13aro »

If this is the wrong place to post, please let me know where I can post this. I ordered a PiOLED for this project and would hate to let it go to waste.

Hello all, I recently set up Pi Hole on my Pi zero. This is my first project so I followed all the instructions here:
https://learn.adafruit.com/pi-hole-ad-b ... 2740982-22

I reached this part and got stuck:
Create a new file with nano ~pi/stats.py and paste this code below in! Then save it.

The ~pi directory doesn't exist when I open nano. Am I missing something? Is there another
directory that I have to put the stats.py file in? Hopefully this is a noob mistake and its easily solvable. Thanks!
Attachments
no_such_directory.png
no_such_directory.png (521.45 KiB) Viewed 124 times

User avatar
freddyboomboom
 
Posts: 267
Joined: Wed Feb 16, 2022 7:55 pm

Re: Beginner Needing Help Setting Up PiOLED

Post by freddyboomboom »

Use either '/home/pi/' or '~/' not '~pi/' for the home directory.

User avatar
adafruit_support_carter
 
Posts: 29153
Joined: Tue Nov 29, 2016 2:45 pm

Re: Beginner Needing Help Setting Up PiOLED

Post by adafruit_support_carter »

How are you connecting to the Pi?

Looks like you are editing as user admin instead of pi?
term.jpg
term.jpg (58.57 KiB) Viewed 111 times

User avatar
bar13aro
 
Posts: 3
Joined: Wed May 04, 2022 3:44 am

Re: Beginner Needing Help Setting Up PiOLED

Post by bar13aro »

freddyboomboom wrote:Use either '/home/pi/' or '~/' not '~pi/' for the home directory.
When I enter nano ~/stats.py it takes me to /home/admin/stats.py , I pasted the PiOLED code in there, is that the proper directory?
Attachments
New_Directory.png
New_Directory.png (144.82 KiB) Viewed 106 times

User avatar
bar13aro
 
Posts: 3
Joined: Wed May 04, 2022 3:44 am

Re: Beginner Needing Help Setting Up PiOLED

Post by bar13aro »

adafruit_support_carter wrote:How are you connecting to the Pi?

Looks like you are editing as user admin instead of pi?
term.jpg
I used putty to ssh to the Pi, and I logged in to my pi using the name and password I created when I set the Pi up. How can I edit as pi instead? Sorry I am really new to this.

User avatar
freddyboomboom
 
Posts: 267
Joined: Wed Feb 16, 2022 7:55 pm

Re: Beginner Needing Help Setting Up PiOLED

Post by freddyboomboom »

This is basic Linux stuff.

The user you are logged in as will have a "home" directory.

The home directories are located in /home/

The learn guide presumes you are using the default user named "pi".

So for the user named "pi", the home directory would be /home/pi/

For the user named "admin", the home directory would be /home/admin/

Linux and other Unix-like operating systems have a shortcut to /home/ that is using the tilde character ~.

So with the shortcut, the home directory for the user names "pi" you could use ~/ in place of typing out /home/pi/.

You should read the Raspberry Pi Beginner's Guide from here: https://magpi.raspberrypi.com/books/beg ... ide-4th-ed There is a free PDF you can download.

User avatar
adafruit_support_carter
 
Posts: 29153
Joined: Tue Nov 29, 2016 2:45 pm

Re: Beginner Needing Help Setting Up PiOLED

Post by adafruit_support_carter »

Yep, agree with above. Make sure you are accessing the Pi as user pi, and not something else, like admin.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”