204 IT: Python Coding Course (204.html)

Keywords

ICH180RR RPi IX Python Raspberry Pi "204 IT: Python Coding Course (204.html)" number string list variable literal append = assignment print input Feynman ambLight KY18 KY-18 KY-018 10K0 resistor 6K8 "CD sensor" "CDS sensor" KY-018INV sortF.py sortFquik.py Terminal grep sort RP3A0 "Raspberry Pi Zero 2 W" "Pi Zero 2 W" Zero2W "matchbox-keyboard bad" matchbox-keyboard-BAD "On-Screen Keyboard" Onboard Keyboard "Onboard keyboard" snippets

/KeywordsEnd

(To enlarge .....Click it)
thumb: IXimage.jpg
IX or DC (IX by DC) or "|><"


This IX software is a part of the IX family of software that I use.

Introduction

This is a web page for people wishing to learn how to code using the Python language.

Course Topics (By Day)



Course Topics / Class Day

Day 1

a = 2 print(a) a = 6 print(a) cList = [] cList = ["Ford", 2, "Joe"] print(cList) cList.append("347") print(cList) print(len(cList))

Day 2

x = 3/2 print(x) x = 3/20 print(x) x = 3/200 print(x) x = 3/2000 print(x) >>>0.0015 x = 2000/3 print(x) >>>666.66666666 x = 12345678901234567890 y = x * 100000000000000000 print(y) >>>1.2345678901234568e+36 cList=["a", "b", "c", "d"] print(cList[2]) >>>c dList=[2,4,6,8,111,12,14] print(dList[2:5]) >>>6,8,111,12 eList=list((8,111,12)) print(eList) >>> 8,111,12

print without format

name = "Eric" print("Hello,", name, ".") >>> 'Hello, Eric .'

print with placeholder and %

name = "Eric" print("Hello, %s ." % name) 'Hello, Eric .'

print with format

name = "Eric" txt = "Hello, {}." print(txt.format(name)) >>>Hello, Eric. price = 49 txt = "The price is {:.2f} dollars" print(txt.format(price)) >>>The price is 49.00 dollars txt = "The price is {:7.2f} dollars" print(txt.format(price)) >>>The price is 49.00 dollars price = 49111 txt = "The price is {:9.2f} dollars" print(txt.format(price)) >>>The price is 49111.00 dollars price = -49111 print(txt.format(price)) >>>The price is -49111.00 dollars

import subroutines

import time

while True :
    time.sleep(2)
    print("after 2 seconds")
#while end
>>>after 2 seconds
>>>after 2 seconds
>>>after 2 seconds
ctrl-C or ctrl-D

Turn On LED using Zero_led.py

#Zero_led.py
import time
from gpiozero import LED
led = LED(14)         # GPIO 14 = phys pin 08
# lead with no resistor is ground phys pin 06
while True:
    led.on()
    time.sleep(1)
    led.off()
    time.sleep(1)
# done 
#************************************************


The Sun contains about 92% hydrogen and 8% helium, with just a tiny bit of the other common elements we find on Earth. Compare that to Earth, where the most common elements are oxygen, magnesium, silicon, and iron.

The mass of the Earth is approximately 5.97×1024 kg. In bulk, by mass, it is composed mostly of iron (32.1%), oxygen (30.1%), silicon (15.1%), magnesium (13.9%), sulfur (2.9%), nickel (1.8%), calcium (1.5%), and aluminium (1.4%); with the remaining 1.2% consisting of trace amounts of other elements.

Day 3

aStr="    abc    "
print(aStr)
bStr = aStr.strip()
print(bStr)

TURN ON LED Using Pushbutton


import time import RPi.GPIO as GPIO 
# Pins definitions
 btn_pin = 4 
led_pin = 12 # Set up pins 15 
GPIO.setmode(GPIO.BCM) 
GPIO.setup(btn_pin, GPIO.IN) 
GPIO.setup(led_pin, GPIO.OUT) # If button is pushed, light up LED 
try: 
     while True: 
         if GPIO.input(btn_pin): 
             GPIO.output(led_pin, GPIO.LOW) 
         else: 
             GPIO.output(led_pin, GPIO.HIGH) 
# When you press ctrl+c, this will be called 
finally: GPIO.cleanup()
Work or Energy joule: unit of work or energy in the International System of Units (SI); it is equal to the work done by a force of one newton acting through one metre. Named in honour of the English physicist James Prescott Joule, it equals 107 ergs, or approximately 0.7377 foot-pounds. 1 joule = 10**7 ergs = 0.7377 foot-pounds.

See Images 01 and 02. 1 watt = 1 joule / sec = 1kg·m²·s**-3

Images

(To enlarge .....Click it)
thumb: PeriodicTable.jpg
Periodic Table


(To enlarge .....Click it)
thumb: LED.jpg
LED (flat [short leg]: ground)


(To enlarge .....Click it)
thumb: Diode_Depletion_Regions.jpg
Diode Depletion Regions


(To enlarge .....Click it)
thumb: DiodeCurve.jpg
Diode Curve


(To enlarge .....Click it)
thumb: E=IR.jpg
Image 03 E = I * R


(To enlarge .....Click it)
thumb: NPN.jpg
NPN


(To enlarge .....Click it)
thumb: NPN_depletion_regions.jpg
NPN depletion regions


(To enlarge .....Click it)
thumb: Transistor_Currents.jpg
PNP current components


Day 4

Day4
Escape characters
   https://www.w3schools.com/python/python_strings_escape.asp
Assembly Language- RPi
   file:///home/pi/Downloads/MagPi116.pdf
7bit Ascii 
   https://en.wikipedia.org/wiki/ASCII#/media/File:USASCII_code_chart.png
JSON example
    JSON_example.txt (See Source 07)
fwrite2.py
SQL DataBase
SQL

Day 5

Feynman (Nobel Prize Winner)

                     Feynman        666
              9 |     999999       + 96
              
                     -------      -----
           9999999   1722766        762  <- Feynman Number


(To enlarge .....Click it)
thumb: FeynmanDiagram.jpg
Feynman Diagram


Day5
   Tristan02.py
       iGalri.html
       PythonINFO_prettify.txt
         use Geany vs
       PythonINFO_prettify.html    

   Geany html
         json
         py
   Serial ASCII
      http://ephotocaption.com/a/179/179.html
     See YouTube Video (Video Source 01 ) to view serial data on an oscilloscope.


(To enlarge .....Click it)
thumb: AsciiData.jpg
Ascii Data On An Oscilloscope


ordAscii.py output The ASCII value of 'p' is 112 in base 10 ch = 'p' ch in hex is x70. ch in octal is o160. ch in binary is 1110000 The price is 112.00 dollars ordAscii.py source # Program to find the ASCII value of the given character progName="ordAscii.py" ch = 'p' print("The ASCII value of '" + ch + "' is", ord(ch)) print("ch = 'p'") print("ch in hex is x%x." % ord(ch)) print("ch in octal is o%o." % ord(ch)) #print("ch in binary is 0b%0b." % ord(ch)) chInt = 112 # ? format number as binary (in base 2) string = "ch in binary is "+ f'{chInt:b}' print(string) # 1110000 price = 112 txt = "The price is {:.2f} dollars" print(txt.format(price)) strElements.py progName: strElements.py strTest: #abcdef strTest[0:7] #abcdef len(strTest) 7 lenStr=len(strTest) strTest[0:lenStr] #abcdef strTest[0:0] strTest[0:1] # strTest[1:2] a #new strTest[1:3] ab #new strTest[0:-1] #abcde strTest[0] # strTest[1] a strTest[-1] f strTest[-lenStr] # strTest[1:-1] abcde strCap=strTest[1:-1].capitalize() Abcde iGal_co0001i.txt iGal_co0001i.html /Days4_and_5.txt

Day 6 : Coding Exercises

Ex01.py
Purpose to reverse the words in a sentence
1. Create a file named Ex01Data.txt containing two rows of words
    eg   saw  kitten joe
           gniht yraM miT
2 crete a function that accepts a word (containing no spaces)
    the function should return the word spelled backwards
3. Write a program that reads the file Ex01Data.txt separates
   each word, calls the function to spell the word backwards
4. prints each resulting line on the screen. . . eg
     eg     was nettik eoJ
            thing Mary Tim

Ex02.py
Purpose: to "draw" a letter on the screen
1. Create a function that accepts a single character
    eg "a"
   It returns a string that "draws" the character
    eg   " xxxx x\n
          xx  xxx\n
          xx  xxx\n
          xx  xxx\n
           xxxx x\n"

2. Write a program that calls the function passing
   the character eg "a".  The subroutine will return
   the "drawing" of the character.  The program then
   prints the drawing of the character on the screen
   using the print statement.

Ex03.py
Purpose: To send Morse Code using the LED.
1  Write a program that flashes a character using 
   Morse Code.  
        e  .     i  ..    s ...
        t  -     m  --    o ...
   It will blink the LED to display the character.
2. The program will first ask the user how long a 
   dot (.) should be.  eg .5  means ".5 seconds"
   A dash (-) should be the length of 3 dots.
   The time between 2 parts of a character should be
   2 dot times
   The time between 2 characters should be at least
   2 dash times.
3. The program asks the user to input one or more
   of the six characters above above to form a word.
   eg   "mom"   "time"  or "i"
4. The program will call a function sending it each character 
   in the word.  The function will turn on and off the
   LED to "send" the character in Morse Code.
5. The program will get the user to input a "word"
   and will call the subroutine to "send" each 
   character of the word in Morse Code.
6. To test the program, just "watch" the LED blinking.

HINT:  Use a Python dictionary to store the characters.
   Also put the following in the dictionary
   "/"  is the sleep time between 2 parts of a character
   " "  is the sleep time between 2 characters.

Refer to Source 08 to hear Morse Code audibly.

Day 7

OHM's law

E = I x R ........ E(volts) = I(amps) x R(ohms)

Resistance of 2 Resistors in Series.

R(series) = R1 + R2

LED symbol

(To enlarge .....Click it)
thumb: LED2.jpg
LED (flat [short leg]: ground)


Resistance of an LED is about 15 ohms in a 3v3 or 5v0 circuit.

How much current passes through an LED in a 3v3 circuit (with no resistor)?

How much current passes through an LED in a 3v3 circuit (with a 330 ohm resistor)?

How much current passes through an LED in a 3v3 circuit (with a 1000 ohm resistor)?

What is a CdS cell?

The resistance of a CDS "photo cell" varies with the amount of light falling on it:
~    500 ohms	in direct sunlight
~  5,000 ohms	in a lit room
~500,000 ohms	in the dark
(To enlarge .....Click it)
thumb: CDS_cell.jpg
CdS Light-Dependant Resistor (PhotoCell)


In the real world of electronics, a common type of light sensor is called a CdS cell, or CdS photoresistor. They have historically used a material called cadmium sulfide to measure the amount of light falling on them. Cadmium is a toxic metal so the use of CdS cells is now very much restricted and other materials have taken their place.

The digLight Python circuit for the Raspberry Pi

This KY-018 circuit reads digLight inverted. To read digLight (uninverted) , interchange 3v3 and GND. This KY-018INV will have 3 leads:
wire                         GPIO      Phys
color  to                     pin       pin
*****  ********************* ****      ****
red    CdS cell               3V3        17
yellow S to 10K Var. Resist.   17        11
green  Ground                 GND         9

Adjust 10K Var. Resist. to be 6K8 ohms
(To enlarge .....Click it)
thumb: http://ephotocaption.com/a/153/KY-18_Schematic.jpg
Inverted ambLight/digLight sensor (KY-018 Schematic)


(To enlarge .....Click it)
thumb: IMG_5349B.jpg
:94 CdS photo-resistor w 5K6 resistor for BreadBoard


The :94 device needs a 90 degree M-F header to attach to a breadboard for the CdS to be accessible. (To enlarge .....Click it)
thumb: IMG_5350.jpg
:95 CdS photo-resistor w 10K0 resistor for RPi


The :95 device is a CsD with a 10K0 variable resistor for an RPi GPIO 4 (phys pin 7).

Dupont Connectors

The multicolored Dupont connectors (jumpers) can be M-M or M-F or F-F.

(To enlarge .....Click it)
thumb: DupontConnectors.jpg
Dupont Connectors (with Male end)


Program to read ambient light as 1 or 0

The following Python program can be used on the Raspberry Pi to read the Binary value of digLight from GPIO17 (which is physical pin 11). Because the Raspberry Pi cannot read analog signals, it cannot read ambLight as a numerical (analog) value.

import RPi.GPIO as GPIO
import time

progName="digLightTest.py"
print("starting ",progName)
print(" Ctrl-C will end the program")
digLight_pin=17  #GPIO pin 17 is physical pin # 11 on the Raspberry Pi
# verified by Tristan Marcoux on 2023GJul25
#  CdS is connected between digLight and nominal 3V3 which is often 3.75v
#  6.8k resistor is connected between digLight and GND.
# 10k   resistor is too high when the back and sides of the CDS are not kept dark.
#  The 6.8k resistor even detects between dim light and dark.
#  It is recommended to use a 10k0 rheostat (variable resistor) initially set to 6K8.
#setup the pins in the software
GPIO.setmode(GPIO.BCM)
GPIO.setup(digLight_pin,GPIO.IN)
try:
	while True:
		if GPIO.input(digLight_pin):
			print("digLight is 1: ON  i.e. lit")
		else:
			print("digLight is 0: OFF i.e. dark")
		#if end
		time.sleep(1) #sleep for 1 second
	#while end
finally:
	print("ending ",progName)
#try end
# /digLightTest.py
#program end

[From Article 153 (Source 09)], the . . . . . digLightTest program was successfully tested on 2021BFeb13 by the author. This PiR2Null device can be used by the programmer to ask for a reply of "Yes" or "No" without the program being "stuck" waiting for an (absent?) operator to reply. While the program is running, to reply "Yes", cover the photocell by touching it with your finger. When covered, the program will say "dark". The same effect can be produced by turning on/off the light switch in a dark room. However, if the room is well lit by natural daylight, it is necessary to cover the photocell somehow to achieve a "dark" result.

To terminate the above program, press ctrl-C. This program was tested by D@CC on 2021BFeb09.

Refer to Video Source 02 for a demo of a CDS PhotoCell (KY-018) and a LED that turns ON when the CD photocell detects "darkness".

On-Line Book: Pico Tips and Tricks (Source 10)

The Raspberry Pi Pico W is available from ThePiHut (US$ 8.93) . Readers are advised to purchase the device with soldered headers if possible.

Refer to Source 10, a book by Malcolm Maclean for many Thonny programs that explore the Pi Pico board. View a short "teaser" preview at Video Source 03.

This book will be of interest to anyone beginning to use the Raspberry Pi Pico or Pico W.

There is an error in the book in Source 10. About 20% through the book, in the section named "General Purpose Input / Output (GPIO)" subsection: "Pull-up and Pull-down Resistors", the diagram named "Pull-down, Pull-up and Floating connections" showing the pull-resistors is wrong. A corrected version is shown below:

(To enlarge .....Click it)
thumb: pull-resistorsOK.jpg
Pull-down, Pull-up and Floating connections (Corrected)


In the above corrected image, the label "GPIO" is the GPIO pin to which the pull-up or pull-down resistor has been connected. In all 3 cases, the GPIO pin is also driven by internal pico electronics and is usually connected to external electronics.

The book in Source 10 provides connection diagrams and MicroPython code to permit the Pico or Pico W to control the following impressive list of devices:

The Maker Drive Board mentioned above is available from Cytron.io or ThePiHut.com . For more information, see the Maker Drive DataSheet at Source 12.

Day 8 Using Terminal and SORTING

SOME TERMINAL COMMANDS

See Source 24 for more information about the Raspberry Pi OS .
Source 22 describes all of the Linux commands including those below eg "sort".

folders: Desktop/Day8

cat a b >c                 # concatenate files
cd  newdir                 # change directory
cp a b                     # copy a file
dir                        # directory list
grep "string" tFile        # display line containing "string" in tFile
grep --help                # display grep options and examples
ls                         # list directory 
more tFile                 # display a tFile
nano tFile                 # edit tFile in Terminal
rm  aFile                  # remove (delete) tFile
sort tFile >bFile          # sort tFile into bFile 
sort --help                # display help options and examples
^ arrow                    # previous (up)
v arrow                    # next (down)
< arrow                    # left
> arrow                    # right
Enter to execute           # run the command as showing

See Source 28 (my Article 170)  for a longer list (of 50 Useful Linux Terminal Commands).

Exercises for Sorting Manually


Sort order is according to ASCII character numerical order.


1A. Create a file named "fox.txt" (one word per line) containing:

the quick brown fox jumps over the lazy dog

1B. Use "grep" to find a record starting with string "jum"

    > $ grep "jum" fox.txt

2. Use a text editor to sort the words ("brown" should be first).

3. Write it out with the name "fox_sorted.txt"

4. Write a Python program to sort any text file (at end of lecture).

5. Use nano in Terminal to manually sort the file 

   > $ cd Desktop/Day8
       cp fox.txt fox_s.txt
       nano fox_s.txt
       Ctrl-o
       Ctrl-z

6. use sort in Terminal to sort the file
   > $ cd Desktop/Day8
       sort fox.txt >fox_sort2.txt

7. use cat to create a file named file1
   > $ cd Desktop/Day8
       cat >file1
       rrrrrr
       xyz
       Ctrl-d

8. use cat to create a file named file2
   > $ cd Desktop/Day8
       cat >file2
       abc
       Ctrl-d

9. use "dir" and "ls" to display the Directory
   > $ dir
       ls
       cd Desktop/Day8
       dir

10. use "more" to display file1
    > $ cd Desktop/Day8
        more file1

11. use "cp" to copy file1 to file3
    > $ cd Desktop/Day8
        cp file1 file3
        ls
        more file3
        Ctril-c

12. use "rm" to delete file3
    > $ cd Desktop/Day8
        rm file3
        ls

13. use "|" for piping
   use cat to join 2 files, show the result, then sort them
   > $ cd Desktop/Day8
       cat file1 file2 > file4
       ls
       more file4

   > $ cat file1 file2 | sort file5
       ls
       more file5

14. Display sort help
   > $ sort --help

    Also see Source 23 for the "sort" section of Linux Man7 Manual (Source 22)

   > $ help sort
       SYNTAX
       sort [OPTION]... [FILE]...
       sort [OPTION]... --files0-from=F

       OPTIONS
       -b         ignore leading blanks
       . . . 
       -r         reverse sort results
       -c         check for sorted input; do not sort
       -o fText   write output to fText file
       etc

Program (Algorithm) to sort a text file

     Name it mySort.py
     0. Create a function named sort2(a,b) to compare 2 records (text strings)
            and return the lowest (the record to appear first when sorted)
        Test this function using a small test program

     Write the mySort.py program to do the following:
     1. recNA=1
     2. Open the input file
     3. lenN= number of records in input file
     4. copy each record into an element of an array named rList
           rList=[]   # empty list (array)
           recN=0
           for rec in file1:
              recN=recN+1
              rList[recN] = rec
           #for end
           display the list of records to be sorted
           print("rList:",rList)
     5. Close the input file
     6. Open the result file (initially empty)
     7. Find the lowest (when sorting) record in rList (using sort2 function)
     8.    Write this record to the output file
     9.    Set this lowest record in rList to Null
     10.          so that it will be effectively "removed" from rList.
     11.   Repeat at step 7 to find the next lowest record
                in rList.
     12.   Stop doing this when rList is empty (when all rlist records are null.
     13.   When done, close the result file
     14.   display the result file.

     See Sources 20 and 21 for better Python programs to sort a text file
     Other algorithms are a bubble sort and a Hashed key file sort.

Day 9

9.1 Create a String Sort program using the Python function "lowest()" from Source 32.
     [lowest() returns the position of the lowest non-nul item, if any, in a list of strings.]

9.2 Connect and use a small powerful Raspberry Pi Zero-2-W (below).

9.3 Review the "Python CheatSheet" in Source 31 to identify "new" concepts.

9.4 Review "Raspberry Pi Benchmarks" in Article 170.

9.5 See the MagPi Magazine article "Learn Python..." on p77 in Source 30.

Day 10

Write 10 small Python Programs. See Source 38.

Day 11

Create a calendar for one month.

Day 12

For each string of letters that are input:

a) how many capital letters are there?
b) how many non-capital (lower case) letters are there?
c) how many digits are there?
d) how many other letters are there?
    "other" means not capital, not non-capital, not digits.
      examples are "$&() etc"
e) how many spaces are there?
f) what is the highest digit in the string?
g) how many characters are vowels?

h) If "Boo" is in the string, print out "Boo" and exit the program

Extra Difficulty
i) what is the highest integer in the string?
    example "A431C998a$47." highest integer is 998
j) Only in the case of a string of 4 lower case letters; 
  print out all three letter words that can be generated
  using only the lower case letters. These three letter
  words must be of the form: non-vowel, vowel, non-vowel
  All words from the string "xopt" would be:
     xop
     xot
     top
     pox
     tox
     pot
     xox
     pop
     tot
  All words from the string"mopi" would be:
   mop
   mip
   pom
   pim
   mom
   mim
   pop
   pip

Day 13

(To enlarge .....Click it)
thumb: Exercise56B.jpg
Exercise 56B


Day 13 is from Source 41.

Raspberry Pi Zero-2-W

(To enlarge .....Click it)
thumb: Pi-Zero-2-W.jpg
Raspberry Pi Zero-2-W
      USB  PWR IN
             Be sure to connect the PWR IN cable
             into the connector closest to the corner
             of the Pi Zero 2 W

Shown above, the new Raspberry Pi Zero 2 W (built around the 64-bit RP3A0 IC), released in 2021 (costing US$ 15.00), is 5 times as powerful as the original Pi Zero and has 512MB SDRAM. It supports 2.4GHz WiFi, BlueTooth 4.2 and BLE. See Source 25 for more product information and Source 26 for a product-brief-pdf describing the Raspberry Pi Zero-2-W. Source 27 provides more detailled Pi Zero 2 W schematics and board information. See Article 167 (Source 29) for a visual comparison of the original Pi Zero, the Pi Zero W and the Pi Zero-2-W (Pi Zero2W).

See Source 29 for various images contrasting the 3 different models of the Raspberry Pi Zero. Source 29 also lists many of the WebMaster's different flash drives and devices. It also describes different methods of loading a Raspberry Pi Linux operating system onto a microSD card. Note that none of Pi Zero boards are sold with soldered male headers. The all just have plated-through holes as shown in the above image.

Recommended "Onboard" keyboard for the Raspberry Pi

The models of the Raspberry Pi Zero have only one USB port. A mouse is absolutely necessary to control a Raspberry Pi and a mouse usually needs to be attached using a USB port. Attaching a keyboard often needs a second USB port or a USB expansion hub. The Onboard keyboard provides the user with an on-screen keyboard meaning that a Pi Zero can be controlled using only 1 USB connector and no USB hub.

No instructions are necessary to install the free Onboard keyboard (shown below). Merely install it like any other software for the Raspberry Pi. This keyboard works immediately after being installed. It can be resized and repositioned on the Raspberry Pi Desktop. It provides many control features, notably "Snippets" which permit phrases or macros to be stored "in the keyboard" and "easily typed"

The Onboard software functions very well under the "BullsEye" version of the Raspberry Pi Operating System. Hopefully Onboard will be easily usable on the Raspberry Pi Zero 2W computer.

The author encountered many issues when he recently tried to install MatchBox-keyboard. All issues disappeared once Onboard was installed.

The author does not recommend the use of the Matchbox-keyboard software on the Raspberry Pi

(To enlarge .....Click it)
thumb: IMG_5478.jpg
Onboard keyboard on BullsEye OS


Notes about Onboard Keyboard on the Raspberry Pi
Of the many versions of Onboard available for the Raspberry Pi, I installed onboard-1.4.1-5+b3 (64 bit) on 2023HAug27.
To invoke Onboard, click on "Universal Access" in the Accessories submenu
Some characters are not in the expected positions (compared to the Raspberry Pi keyboards):
 The "\" is to the left of the "Enter" key
 The "|" is "shift-\"
 The "<" appears to the left of the "z" key and elsewhere on other layouts
Feature: "Alt-Gr-F dhighlighted the Subfile "F" menu (like "ctrl-f") in the Raspberry Pi text editor.
Feature: A tiny "mobile" keyboard layout is available for tiny displays.
Feature: Click on the three horizontal bars (bottom right corner) to access the Snippets.
Feature[?]: My Snippets were not lost when I uninstalled and re-installed Onboard.
Feature: Clicking on the "X" in the top right corner toggles Onboard from the display.
Feature: Snippets can be viewed and deleted using the "Tools" button
  But any snippet text defined using "Tools" are not retained; they must be re-entered.

Onboard Source, Author & Interactions

The author of this website has discovered in the Raspberry Pi "/usr/share/onboard/tools" folder, some python-3 source code named "checkmodels" originally written by marmuta in 2014. It might of some interest to readers that part of Onboard was written in Python. See Source 35 to review or interact with the authors of Onboard.

Onboard Linux Manual and Issues

A comprehensive manual describing Onboard has not been found. Source 34 contains little more than what is in the existing linux manual. On the Raspberry Pi, the Onboard linux manual can be viewed in the Terminal using the following command:
	>$ man 1 onboard
	
The author has discovered an example of a configuration (control) file for Onboard. It can be unzipped using "Archiver" from "/usr/share/doc/onboard/onboard-defaults.conf.example.gz".

As of 2023HAug28, the existing Onboard issues on the Raspberry Pi under Bullseye OS are:

Issue 1 Typing Assistance didn't work on BullsEye on the Raspberry Pi in 2023HAug.
  CAVEAT: Notes said that GNOME was a prerequisite
Issue 2 Turning ON "Typing Assistance" caused Onboard to Hang and NOT reload, even after uninstalling & rebooting.
  FIX: Right-Click on Universal Access-Onboard, then click Properties, then turn OFF "Typing Assistance"
Issue 3 Snippets cannot be added using the "Tools" button (ADD field is inoperative)
  WORK-AROUND: Add the snippet again using the Snippet button
Issue 4 Onboard Help is not available (GUI)
  WORK-AROUND: See the CLi Onboard Help file in Source 33 or the Onboard linux manual, then load it and view it as a Snippet.

Bash Commands as Onboard Keyboard Snippets

Simply terminate the command in the snippet with a space, a backslash and the letter n. (Exclude the ">$ ".) For example:
	>$ ls \n
	
This above Snippet will "tell" the active Terminal window to list the contents of the working directory. Multiple bash commands can even be stored in one Snippet. An extra space should follow each " \n" for better readability. Of course, a Raspberry Pi Terminal window needs to be open and active for this to function correctly. This is a novel alternative to using bash batch shell files.

Handling of Control Files during Software Installs & Uninstalls

MAJOR ISSUE
User-configurable control files should be resettable by the user when software is installed or uninstalled. The author has had numerous difficulties when trying to re-install software packages "from scratch". The cause has been that some control files (or user data) has not been re-initialized when being installed. Sometimes, a user wishes to keep (i.e. not lose) valuable user data (or data embedded in control files). But sometimes, keeping user data or a control file causes the re-install of the software to function incorrectly. This occured in Issue 1 above for the Onboard keyboard.

For example, I considered trying to use the "Typing Assistance" option in the Onboard keyboard. I noted that it mentions that GNOME software was a prerequisite in Linux. I was not certain if GNOME software was installed on the Raspberry Pi, but I turned on "Typing Assistance", keeping in mind that this might cause me a problem. Well. . . . it did. . . . cause me a problem.

However, I was surprised that, due to this, the Onboard keyboard refused to start up and provided no error message. I tried uninstalling and re-installing Onboard, to no avail. I didn't want to create a new microSD card and reload everything, but I was beginning to run out of options. Finally I did a right-mouse-click on the Onboard button, saw a "Properties" button appear, clicked on it and turned off "Typing Assistance". Problem solved. If only . . . . the installer would have given me the option to remove all user and/or control data related to the Onboard software. Perhaps this option would rarely be used, but it would have given me another option to try before "starting all over again" by creating a new microSD card.

Related Thoughts

As of 2023GJul24, the webmaster has done an inventory of all the devices that he has recently received. Mainly they are grouped by their common order numbers, although some have been loaded into plastic boxes separated into compartments. A detailed inventory list of these devices is available as Web Source 11 named "IX Device Inventory at 621ON". It also lists the contents of 10 compartmentalized plastic boxes of electronic components. Older inventory such as cabinets with drawers full of transistors, condensors, diodes, LEDs and resistors has not been documented.

Source 18 describes how the tiny ESP-01 WiFi board permits the Cytron Maker Pi Pico board to commmunicate using WiFi. Source 16 shows how to use the LM386 Audio Amplifier in a simple circuit. Source 17 is a DataSheet for the LM386 Audio Amplifier. Both the ESP-01 and the LM386 can be found in inventory in Source 11.

SwitchDoc Labs is closing its doors in July 2023. Thankfully, Shawn Rice has archived much of the documentation of its product in Source 19.

Source 30 is a link to a recent MagPi magazine article on page 77. The article is entitled "Learn Python With Raspberry Pi: Beginner's Guide 4th Edition" by Gareth Halfacre. He recommends 3 websites for you to bookmark. It is possible to download all issues of the MagPi magazine. Contact the website author (D@CC) if you wish a copy of many of these MagPi issues delivered on a FlashDrive. The cheatsheet at Source 31 will be of special interest to those beginning to learn Python.

I extend my thanks to the owner of " freefind " for weekly updates of the "searchable index" of all my Articles.

As of 2023HAug22, ZDNet has announced that Python and ChatGPT will soon be available to users of MicroSoft Excel.

Sources 36 and 37 provide, for the Raspberry Pi, a list of Terminal commands and a glossary of terms respectively.

Source 39 describes how to use Bluetooth (without pairing) on the Pico W. An example shows how to send the temperature of the Pico W processor to a nearby computer. Two samples of code are provided (for each end of the transmission). The Python code is quite complex. This code uses little-endian 2-byte signed integers.

Sources

Video Sources

Video Source V204:01: Ascii Serial Data on an Oscilloscope (0:31m) by TektronixSupport in 2022
Video Source V204:02: Raspberry Pi with KY-018 (3:13m) by Pi Club in 2016
Video Source V204:03: Raspberry Pi Pico Tips and Tricks (4:20m) by Malcolm Maclean in 2023 C Mar 00


Web Sources

Web Source S204:01:www W3 Python Lists W3 Python List on 2023GJul09
Web Source S204:02:www Semiconductor Doping By WikiBooks on 2023GJul09
Web Source S204:03:www Semiconductor Diode Operation By WikiBooks on 2023GJul09v
Web Source S204:04:www Python String Methods by W3schools.com on 2023GJul09
Web Source S204:05:www Transistor Currents by Physics & Radio on 2023GJul09
Web Source S204:06:www Diodes by electronics tutorials on 2023GJul09
Web Source S204:07:www JSON squad example by ckasby at github before 2023GJul09
Web Source S204:08:www Morse Code Generator by support@morsecodes.io on 2023GJul18
Web Source S204:09:www A&C: PiR2Null Area Controller (153) by D@CC on 2021BFeb08
Web Source S204:10:www Raspberry Pi Pico Tips and Tricks (>100 p) by Malcolm Maclean before 2023GJul24
Web Source S204:11:www IX Device Inventory at 621ON by D@CC on 2023GJul24
Web Source S204:12:www Cytron Maker Drive Datasheet by Cytron on 2019BFeb00
Web Source S204:13:www emailSender_py.txt by Malcolm Maclean before 2023GJul24
Web Source S204:14: www RPi Pico W DataSheet (25 p) by Raspberry before 2023FJun14
Web Source S204:15: www nxp 74hct9046a VCOsc Datasheet by Cytron/Mouser / NXP 2009ISep 15
Web Source S204:16: www LM386 Audio Amp Circuit by Circuits DIY on 2020 A Jan 22
Web Source S204:17: www LM386 Audio Amp DataSheet by ti on 2020 A Jan 22
Web Source S204:18: www ESP-01 (Using the ESP8266 Module) by Propellerpowered before 2017 E May 00
Web Source S204:19: www SwitchDoc Labs Product Pages and Documentation Archive by SwitchDoc Labs on 2023 G Jul 26
Web Source S204:20: www sortF.py as txt by D@CC on 2023HAug01
Web Source S204:21: www sortFquik.py as txt by D@CC on 2023HAug01
Web Source S204:22: www The Linux Programming Interface by Michael Kerrisk on 2010JOct00
Web Source S204:23: www SORT OPTIONS from The Linux Programming Interface by Michael Kerrisk on 2010JOct00
Web Source S204:24: www Raspberry Pi OS Documentation by Raspberry Pi Foundation in 2022
Web Source S204:25: www Raspberry Pi Zero 2 W Specs by Raspberry Pi Foundation in 2021
Web Source S204:26: www Raspberry Pi Zero 2 W product brief (6 pp) by Raspberry Pi Foundation in Oct 2021
Web Source S204:27: www Raspberry Pi Zero 2 W schematics and board specifications by Raspberry Pi Foundation in Oct 2021
Web Source S204:28: www Pi: Useful Raspberry Pi Device Family Terminal Commands (170.html) by D@CC on 2022 B Feb 25
Web Source S204:29: www IT: Flash Drive & Device Library (167.html) by D@CC on 2014 G Jul 29
Web Source S204:30: www Pi: MagPi Magazine Issue 132 by Raspberry Pi on 2023 H Aug 21
Web Source S204:31: www IT: Python cheatsheet by QuickRef.ME before 2023 H Aug 21
Web Source S204:32: www Pi: lowest.py (stored as *.txt) by D@CC on 2023 H Aug 22
Web Source S204:33: www Onboard Help (CLI) by Onboard on 2023 H Aug 27
Web Source S204:34: www Onboard Linux Manual by Mike Gabriel at SysTutorials before 2023 H Aug 27
Web Source S204:35: www Launchpad.net Onboard Website by Onboard as of 2023 H Aug 27
Web Source S204:36: www Raspberry Pi Commands by Rpi as of 2023 H Aug 27
Web Source S204:37: www Raspberry Pi Glossary by RPi as of 2023 H Aug 27
Web Source S204:38: www 10 Python Programs to Write by programiz.com as of 2023 H Aug 29
Web Source S204:39: www Bluetooth on Pico W by Ben Everard as of 2023 H Aug 24
Web Source S204:40: www Bluetooth on Pico W by Ben Everard as of 2023 H Aug 24
Web Source S204:41: www Python Basic Exercise for Beginners by PYnative as of 2023 H Aug 31


/SourcesEnd

There is a way to "google" any of the part-numbers, words and phrases in all my articles. This "google-like" search limits itself ONLY to my articles. Just go to the top of "ePC Articles by Old King Cole" and look for the "search" input box named "freefind".

Click here to return to Articles by Old King Cole

Date Written : 2023 F Jun 12
Last Updated:2023 K Nov 23

All rights reserved 2023 by © ICH180RR

saved in E:\E\2022\DevE\MyPagesE\Globat\ePhotoCaption.com\a\204\204.html
backed up to ePhotoCaption.com\a\204\204_2023GJul26.html

Font: Courier New 10 (monospaced)
/204.html