dmfaber1 / TunerPi

Raspberry Pi Guitar Tuner
1 stars 0 forks source link

As a Ken, I want to learn to use Python and deploy to the Raspberry Pi #5

Open dmfaber1 opened 3 years ago

dmfaber1 commented 3 years ago
  1. Install Python extension for VSCode (https://code.visualstudio.com/docs/editor/extension-gallery)
  2. Create hello_world.py file in your TunerPi directory. Enter the following code: "print("Hello World")"
  3. Use VSCode to run the file (https://code.visualstudio.com/docs/python/python-tutorial)
  4. Familiarize self with other python tutorial https://python.land/python-tutorial and python documentation https://wiki.python.org/moin/BeginnersGuide
  5. Create script that will toggle gpios on raspberry pi (https://www.raspberrypi.org/documentation/usage/gpio/python/README.md) (https://www.raspberrypi.org/documentation/usage/gpio/)
  6. Copy file to raspberrypi. scp test.py pi@raspberrypi:/tmp
  7. Run file on raspberrypi. ssh pi@raspberrypi, cd /tmp,python test.py
faberke611 commented 3 years ago

1, 2, 3: Done , 4: Bookmarked page for future reference , 5: Started to read about this one , 6, 7: Used Git Bash. Worked. Note I changed my host name from raspberrypi to kenpi-1. I named my test file hello.py. After each command line, scp and ssh, it asked me for my password again (?) Is that normal? Tried running ssh command using Ubuntu: "Could not resolve hostname". Connected to board using PuTTY. Ran commands: cd /tmp and python hello.py. It worked. I'm still uncertain when/why I should use each of these 3 apps.

faberke611 commented 3 years ago

Tried some code for testing the Traffic Lights: https://www.raspberrypi.org/documentation/usage/gpio/python/README.md https://projects.raspberrypi.org/en/projects/traffic-lights-python/2 http://wiki.lowvoltagelabs.com/pitrafficlight_python_example

Tried running in VSCode Terminal panel and it's not recognizing commands. I think I'm missing some basic understanding on how to use VSCode. Maybe you can walk me through a case over the phone

Other notes: Low Voltage Labs says: Pi Zero requires that pins are soldering into the 40-pin header. Raspberry says I need to install Mu: sudo apt install mu-editor . Do I need to install to board? VSCode gave me a warning

dmfaber1 commented 3 years ago

After each command line, scp and ssh, it asked me for my password again (?) Is that normal? Tried running ssh command using Ubuntu: "Could not resolve hostname". Connected to board using PuTTY. Ran commands: cd /tmp and python hello.py. It worked. I'm still uncertain when/why I should use each of these 3 apps.

Every time you open a remote connection using openssh, it will ask to authenticate. So the act of a scp command, it is opening a connection, copying a file over that connection, and closing that connection. The ssh command is opening that connection, and opening a remote shell on the device, then you can do whatever commands you want to here, and when you exit the remote shell, it will close that connection. So every time you are doing a ssh or scp command it will need to authenticate. Similar to when we set up git, you can use ssh keys to automatically authenticate, but that's a little harder to troubleshoot remotely.

Right now we are using all three programs as an ssh client. They all perform this function, and can be used to talk to your raspberry pi. But if you want a more generalized statement, Git Bash is for performing command line git operations on Windows. PuTTY is a Windows client for a number communication protocols (ssh, telnet, serial, etc). Ubuntu WSL is a complete linux terminal environment for Windows.

I think I'm missing some basic understanding on how to use VSCode. Maybe you can walk me through a case over the phone

Yeah lets talk sometime tomorrow

Raspberry says I need to install Mu: sudo apt install mu-editor

No, you shouldn't need that.

Pi Zero requires that pins are soldering into the 40-pin header.

Hmm yeah that seems like an oversight on my part. The Raspberry Pi Model 3 didn't, that's the one i have used in the past. They might sell some solderless adapters, i can take a look.

faberke611 commented 3 years ago

Got python to work from command prompt. Just needed to add the path to the Windows PATH file

dmfaber1 commented 3 years ago

So the last thing on this story was the open question on solderless adapters. This is what I would recommend: https://www.adafruit.com/product/3413

Otherwise, if you still have your old soldering iron, I bet you could solder the header on pretty easily.