diff --git a/boards/beaglebone/ai/ch03.rst b/boards/beaglebone/ai/ch03.rst index 8dbbb315f617dabeb39e50a18be4013283d88753..ae24689a0b71a08af13581b507e643bf130322a2 100644 --- a/boards/beaglebone/ai/ch03.rst +++ b/boards/beaglebone/ai/ch03.rst @@ -148,9 +148,6 @@ Standalone w/Display and Keyboard/Mouse Load "am57xx-eMMC-flasher-debian-9.13-lxqt-tidl-armhf-2020-08-25-6gb.img.xz" image on the BeagleBone® AI -Presently, the "Cloud 9" application is broken in debian 10 only for -this configuration. We re working on a better solution. - 1. Connect a combo keyboard and mouse to BeagleBone® AI’s USB host port. 2. Connect a microHDMI-to-HDMI cable to BeagleBone® AI’s microHDMI port. 3. Connect the microHDMI-to-HDMI cable to an HDMI monitor. diff --git a/boards/pocketbeagle/original/ch03.rst b/boards/pocketbeagle/original/ch03.rst index b1385f323e3f354e5bc51c22653cb9852bc496df..a0ab734e62fc9ce8de16ba34c13b4c6fe187bf33 100644 --- a/boards/pocketbeagle/original/ch03.rst +++ b/boards/pocketbeagle/original/ch03.rst @@ -236,8 +236,8 @@ server that is running on PocketBeagle). Copy the appropriate IP Address from the chart (according to your PC operating system type) and paste into your browser then add a **:3000** to the end of it. See example in Figure 16 below. This will launch from PocketBeagle one of it's favorite -Web Based Development Environments, Cloud9 IDE, (Figure 17) so that you -can teach your beagle new tricks! +Web Based Development Environments, Visual Studio Code, (Figure 17) +so that you can teach your beagle new tricks! .. figure:: images/16fig-PB-enablenetwork.png :align: center @@ -245,53 +245,76 @@ can teach your beagle new tricks! Enable a Network Connection -.. figure:: images/17fig-PB-cloud9.png +.. figure:: images/vscode1.png :align: center - :alt: Launch Cloud9 IDE + :alt: Launch Visual Studio Code IDE - Launch Cloud9 IDE + Launch Visual Studio Code IDE -1. Get Started Coding with Cloud9 IDE - blinking USR3 LED in JavaScript -using the BoneScript library example +#. Get Started Coding with Visual Studio Code IDE - blinking USR LEDs in Python. -#. Create a new text file +#. Navigate to the code. Select ``examples/BeagleBone/Black/seqLEDs.py``. -.. image:: images/SRM1_cloud9blinkPB.png +.. image:: images/vscode2.png -Copy and paste the below code into the editor +The code should match the code below, if you can't find it, copy and paste the below code into the editor -.. code-block:: +.. code-block:: python - var b = require('bonescript'); - var state = b.LOW; - b.pinMode("USR3", b.OUTPUT); - setInterval(toggle, 250); // toggle 4 times a second, every 250ms - function toggle() { - if(state == b.LOW) state = b.HIGH; - else state = b.LOW; - b.digitalWrite("USR3", state); - } + #!/usr/bin/env python3 + # //////////////////////////////////////// + # // seqLED.py + # // Blinks the USR LEDs in sequence. + # // Wiring: + # // Setup: + # // See: + # //////////////////////////////////////// + # // Tested: may: 2022.06.29 - BBB - 5.10.109-ti-r45 + import time + import os + LEDs=4 + LEDPATH='/sys/class/leds/beaglebone:green:usr' -.. image:: images/SRM2_cloud9blinkPB.png + # Turn off triggers + for i in range(LEDs): + # print(LEDPATH+str(i)+"/trigger") + f = open(LEDPATH+str(i)+"/trigger", "w") + f.write("none") + f.close() -.. image:: images/SRM3_cloud9blinkPB.png + # Open a file for each LED + f = [] + for i in range(LEDs): + f.append(open(LEDPATH+str(i)+"/brightness", "w")) -Save the new text file as *blinkusr3.js* within the default directory + # Sequence + while True: + for i in range(LEDs): + f[i].seek(0) + f[i].write("1") + time.sleep(0.25) + for i in range(LEDs): + f[i].seek(0) + f[i].write("0") + time.sleep(0.25) -Execute -.. code-block:: +Open a terminal by selecting ``Terminal/New Terminal`` +(or pressing ``Ctrl+Shift+```) and execute the code: - node blinkusr3.js +.. image:: images/vscode3.png -within the default (/var/lib/cloud9) directory +.. code-block:: shell-session + bone:~$ cd ~/examples/BeagleBone/Black + bone:~$ ./seqLEDs.py -.. image:: images/SRM4_cloud9blinkPB.png +You will see the four USR LEDs flashing. +.. image:: images/vscode4.png -Type CTRL+C to stop the program running +Type CTRL+C to stop the program running. .. _powering_down: diff --git a/boards/pocketbeagle/original/images/vscode1.png b/boards/pocketbeagle/original/images/vscode1.png new file mode 100644 index 0000000000000000000000000000000000000000..97494363ee0f5eb397999e5c499482a46cbf3ea2 Binary files /dev/null and b/boards/pocketbeagle/original/images/vscode1.png differ diff --git a/boards/pocketbeagle/original/images/vscode2.png b/boards/pocketbeagle/original/images/vscode2.png new file mode 100644 index 0000000000000000000000000000000000000000..8525529dce1c0fd2afcd09615657f951bf147948 Binary files /dev/null and b/boards/pocketbeagle/original/images/vscode2.png differ diff --git a/boards/pocketbeagle/original/images/vscode3.png b/boards/pocketbeagle/original/images/vscode3.png new file mode 100644 index 0000000000000000000000000000000000000000..9579f34b0c7e9bdb9ac980e4770f04a46022f2d7 Binary files /dev/null and b/boards/pocketbeagle/original/images/vscode3.png differ diff --git a/boards/pocketbeagle/original/images/vscode4.png b/boards/pocketbeagle/original/images/vscode4.png new file mode 100644 index 0000000000000000000000000000000000000000..2631f53e8cf0f24e00ac296d8873843f7a723609 Binary files /dev/null and b/boards/pocketbeagle/original/images/vscode4.png differ