<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Python on Bald Engineer</title><link>https://www.baldengineer.com/tag/python</link><description>Recent content in Python on Bald Engineer</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 26 Jul 2024 14:57:29 +0000</lastBuildDate><atom:link href="https://www.baldengineer.com/tag/python/index.xml" rel="self" type="application/rss+xml"/><item><title>Python to set 8th bit in ASCII String</title><link>https://www.baldengineer.com/python-to-set-8th-bit-in-ascii-string.html</link><pubDate>Sun, 30 Jun 2024 17:18:31 +0000</pubDate><guid isPermaLink="false">https://www.baldengineer.com/?p=9024</guid><description>The Apple II’s ROM has the 8th bit set for all of its ASCII strings. This convention makes it difficult to search the ROM for hex strings quickly. This Python script takes an ASCII string and returns the HEX string with (and without) the 8th bit set.&#10;Python Code input_string = "Mega IIe" def string_to_hex_ascii(input_string, set_bit_8=False): hex_values = [] for char in input_string: # Get the ASCII value of the character ord() and convert it string # representing the hex() value # # [2:] strips the '0x' if (set_bit_8): hex_value = (hex(ord(char) | 0x80)).upper() # for Apple II, awww else: hex_value = (hex(ord(char))).upper() hex_values.append(hex_value[2:]) return hex_values def print_list_with_spaces(input_list): # Join the list elements into a single string with spaces in between result = ' '.join(map(str, input_list)) print(result) def print_og_string_formatted(input_string): result = ' '.join(input_string) print(result) # Remind user of string print("Og : ", end='') print_og_string_formatted(input_string) # As-is ASCII in Hex hex_values_raw = string_to_hex_ascii(input_string) print("Raw : ", end='') print_list_with_spaces(hex_values_raw) # Hex with 8th bit set hex_values_8bit = string_to_hex_ascii(input_string, True) print("8bit: ", end='') print_list_with_spaces(hex_values_8bit) Disclaimer: I used ChatGPT to generate an initial script for converting an ASCII string to a list of hex values. Then, I wrote the rest.</description></item><item><title>7+ Python Engineering Modules for Electronics Engineers</title><link>https://www.baldengineer.com/7-python-engineering-modules.html</link><pubDate>Thu, 11 Jul 2019 12:50:23 +0000</pubDate><guid isPermaLink="false">https://www.baldengineer.com/?p=7907</guid><description>Python is everywhere. Its capabilities continue to grow. Not only can you create simple scripts, but you can create full-blown applications with it. The core has been scaled down to run on 32-bit microcontrollers like the ESP32 and Adafruit Feather M0. You can even use Python engineer modules to design stuff like circuits. There are electronics Python modules that create schematics, simulate circuits, and make solving math a cinch. Here are some of the modules I found that make Python usable for (electronics) engineering.</description></item><item><title>6 things I learned about KiCad at KiCon 2019</title><link>https://www.baldengineer.com/6-things-i-learned-about-kicad-at-kicon-2019.html</link><pubDate>Fri, 17 May 2019 18:26:00 +0000</pubDate><guid isPermaLink="false">https://www.baldengineer.com/?p=7786</guid><description>In April 2019, hardware hackers, hobbyist, and engineers joined together for the first KiCon. A couple of people asked me, “why is there a conference for KiCad?” Some questioned if KiCad was significant enough software to warrant a conference. That question is valid. But KiCon is larger than the KiCad software. Even in its first iteration, KiCon evolved more into a meeting for people building electronics hardware from small scale hobbyist to professionally designed systems, than just a conference on a single piece of software. Some might call it a maker conference. I call it a hardware developer conference. The key that tied everyone together is the open source software behind our printed circuit boards.<p><img src="https://www.baldengineer.com/wp-content/uploads/2019/05/Kicon2019-Banner.jpg" alt="6 things I learned about KiCad at KiCon 2019"/></p></description></item><item><title>Circuit Python adds Python to Microcontrollers</title><link>https://www.baldengineer.com/circuit-python.html</link><pubDate>Wed, 14 Feb 2018 14:57:09 +0000</pubDate><guid isPermaLink="false">https://www.baldengineer.com/?p=7000</guid><description>Back in 2013, a Kickstarter ran for a project to put a python interpreter on a microcontroller. At the time I could not see the benefit. Cool project, but I asked myself: “why?” On my last Adafruit order, I received a free Circuit Playground Express. The board comes with CircuitPython pre-installed. After playing with Circuit Python, or CP, I finally “get it.”&#10;For Valentine’s Day, I made an animated LED heart for a new love in my life, Circuit Python. Well, love is a bit of a strong word. The past couple of weeks I have been l earning Circuit Python, and I am excited by what it offers.<p><img src="https://www.baldengineer.com/wp-content/uploads/2018/02/Circuit-Python-LED-Matrix-Example-Banner-1600px.jpg" alt="Circuit Python adds Python to Microcontrollers"/></p></description></item><item><title>Pi Cap Hands On Review</title><link>https://www.baldengineer.com/pi-cap-hands-review.html</link><pubDate>Wed, 16 Aug 2017 13:05:52 +0000</pubDate><guid isPermaLink="false">https://www.baldengineer.com/?p=6657</guid><description>The Pi Cap adds capacitive touch buttons to your Raspberry Pi. Bare Conductive was kind enough to send me one. I do not have a project in mind right now, so here are my first impressions.&#10;What is the Pi Cap? Arduino tends to call daughter cards shields, while the Raspberry Pi community calls them hats. The Pi Cap is a hat. It plugs into the GPIO header of a Raspberry Pi and provides 13 capacitive touch pads. There is a traditional push button, an LED, and a prototyping area. While the Pi Cap does consume all of the GPIO pins, several are broken out near the GPIO header.<p><img src="https://www.baldengineer.com/wp-content/uploads/2017/08/Pi-Cap-Header-1520px.jpg" alt="Pi Cap Hands On Review"/></p></description></item><item><title>Arduino Data Logger: Serial Monitor Alternatives</title><link>https://www.baldengineer.com/arduino-data-logger-options.html</link><pubDate>Wed, 05 Apr 2017 13:00:56 +0000</pubDate><guid isPermaLink="false">https://www.baldengineer.com/?p=6396</guid><description>The Arduino serial monitor is usable when you want to watch data from an Arduino. However, it does not have a built-in method for saving the data. Here are some ideas if you want to build an Arduino data logger with or without a PC.&#10;Important note on Arduino Data Logger examples With all of these examples, please remember that whenever you open the Arduino’s serial port, the board will reset. So if your log file shows “Initializing SD card…” with a few data lines in between, it is because there is a reset happening.<p><img src="https://www.baldengineer.com/wp-content/uploads/2017/04/arduino-data-logger-options-banner-v2b.jpg" alt="Arduino Data Logger: Serial Monitor Alternatives"/></p></description></item><item><title>Raspberry Pi GUI Tutorial</title><link>https://www.baldengineer.com/raspberry-pi-gui-tutorial.html</link><pubDate>Wed, 03 Feb 2016 17:58:53 +0000</pubDate><guid isPermaLink="false">https://www.baldengineer.com/?p=5750</guid><description>My favorite Raspberry Pi add-on is the PiTFT from Adafruit. With it, you easily get a Raspberry Pi GUI interface and touch screen. The PiTFT software install is just a few things and it is good to go.&#10;Adafruit PiTFT - Click for more info&#10;This screen is what I needed for my IoT project. The Pi+Screen will act as the primary controller for all of my things. The problem is I didn’t know much about writing GUI applications in Linux. So what could I do to create a Raspberry Pi GUI?<p><img src="https://www.baldengineer.com/wp-content/uploads/2016/02/raspberry-pi-gui-tutorial-hero-v3.jpg" alt="Raspberry Pi GUI Tutorial"/></p></description></item></channel></rss>