I started out trying to modify my old scripts that were written in Python 2 and trying to write them in Python 3. After some tinkering around and tweaking of the code I decided to start fresh and try to write my code in a more modular form.
In this project 2 Python files are executed
weather.py gets data from the sensors of the sense HAT and displays them on the 8×8 LED matrix. Depending on the temperature taken the LED screen background color changes lines 20-36 (Since the Sense HAT is placed directly atop the pi, the temperature’s are affected by the CPU temp of the pi). It then logs the data taken by the sensors. The next part of the script sets the orientation of the LED matrix by reading the acceleration data. Finally it prints the data taken to the LED matrix.
web_app.py takes the same data as weather.py but instead of displaying it on the LED matrix it creates a web server and displays it via the web using flask.
weather.html is used with web_app.py to display Sense HAT data on port 5000 of the raspberry pi
I would like to add the ability to setup email alerts using the web interface. I currently have an email module setup to send emails, I just need to figure out how to set the alerts using the web interface.
Rewriting this script was very rewarding and I learned a lot along the way. I learned how to properly setup a requirements file and use flask. This blog post was very helpful in learning how to package Python. This project has been a lot of fun and I will continue to work on it and improve it.
I started teaching myself python about 8 months ago. The last 3 months I have been studying and coding consistently. On November 17th, 2016 I posted to my old blog one of my first python projects. I have come a long way since then and wanted to share my story and some of the lessons I’ve learned so far.
When I was first choosing a language to learn I referred to ieee.org 2016 top languages chart. At the time C was the top language. I researched furiously until finally deciding Python. One of the reasons I chose to go with Python was the fact that most major universities were switching to Python as the language of choice for introducing students to computer science. At the time of writing this it is now the no.1 language according to ieee.org.
I started using codecademy but struggled greatly since I had no previous programming experience. Being a very hands on person I decided I would try and take on a project to learn to code. I decided to buy a Raspberry Pi with a Sense HAT and build a mini weather station. The project was a great learning experience. I learned how to install Python, use pip to download and install packages, import modules, and start learning python syntax. About a month after that project I wrote my first python script. The script I wrote queries CoinDesk’s API for the current Bitcoin price and last years Bitcoin price and prints it out. After these two projects I focused on getting my CompTIA Network+ certification and Python got put on the back-burner.
After getting Network+ certified I needed a new Python project to work on. After spending plenty of time going through reddit on /r/learnpython I decided to try learnpython.org. Learnpython.org ended up being a great resource for a beginner such as myself. After completing most of the exercises I moved on to Automate the Boring Stuff. From ATBS I created a few projects such as, a web scraper, smtp alerts, and some web browser automation. I started getting restless again and felt like I needed something new to work on.
A little less than 2 months ago I discovered DataCamp. DataCamp uses data science to teach programming. I am currently enrolled in the Python Developer Career Track and at the time of writing this 80% complete with the course. I’ve enjoyed DataCamp and definitely think it is money well spent so far, I paid $180 for a 1 year subscription. There are several more Python classes available after I finish the current course I am taking and they recently introduced SQL classes that I’m interested in.
The last 2 months I have been spending almost all of my free time working on honing my Python programming skills. I have even been listening to Python podcasts. One of the better Python podcasts I have been enjoying is Talk Python To Me. While listening to the podcast there was a commercial for the Python training provided by the host Michael Kennedy. I really like Michael’s approach to teaching, he provides videos from start to finish and includes his code on github so you can follow along. I prefer to have working code on my workstation instead of working out of an IPython notebook.
That brings us to where I am now. I’ve been working at my current job for almost 6 months now where Python is heavily used. For the last month I have been writing Python scripts that are used in production! I have been able to automate tasks for myself and my employees saving countless hours. At this stage I finally consider myself a beginner programmer. In 8 months I have gone from zero programming experience to writing scripts that are used in production at my job.