Skip to content

Commit

Permalink
Adding examples and fixing missing admonition
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkFun-Documentation-Team committed Dec 10, 2024
1 parent 2388aa2 commit eef59f4
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 13 deletions.
46 changes: 35 additions & 11 deletions docs/arduino_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,41 @@ This example demonstrates how to use the navigation switch and detect if the SD

The code for this example can be found in the [Firmware](../Firmware/Example1_NavigationSwitch/) folder of this repository. Alternatively, you can expand the link below and copy and paste the code into a shiny new Arduino sketch:

??? "Example 1 Arduino Code"
```
--8<-- "https://raw.githubusercontent.com/sparkfun/SparkFun_Portability_Shield/refs/heads/main/Firmware/Example1_NavigationSwitch/Example1_NavigationSwitch.ino"
```


One thing to note is that you will also need to install the SparkFun I2C Expander Arduino Library if you haven't already. You can click the link from within the code or you can download the zip from [the GitHub Repository](https://github.com/sparkfun/SparkFun_I2C_Expander_Arduino_Library/archive/refs/heads/main.zip)
One thing to note is that you will also need to install the SparkFun I2C Expander Arduino Library if you haven't already. You can search the library from within the Arduino Library manager, download the zip from [the GitHub Repository](https://github.com/sparkfun/SparkFun_I2C_Expander_Arduino_Library/archive/refs/heads/main.zip) and install it manually, or you can click the link from within the code. Clicking the link will show something like the following:

<figure markdown>
[![SparkFun I2C Expander Arduino Library Install](assets/img/I2CExpanderLibraryInstall.png){ width="90%" }](assets/img/I2CExpanderLibraryInstall.png "Click to enlarge")
<figcaption markdown>SparkFun I2C Expander Arduino Library Install</figcaption>
</figure>



Make sure you've selected the correct board (in this case, we are using the RTK Postcard) and port in the Tools menu and then hit the upload button. Once the code has finished uploading, go ahead and open a [Serial Monitor](https://learn.sparkfun.com/tutorials/terminal-basics). You should see something similar to the following.

<figure markdown>
[![Arduino Example 1 Output](assets/img/Example1_Output.jpg){ width="90%" }](assets/img/Example1_Output.jpg "Click to enlarge")
[![Arduino Example 1 Output](assets/img/Example1_Output.png){ width="90%" }](assets/img/Example1_Output.png "Click to enlarge")
<figcaption markdown>Example 1 Output</figcaption>
</figure>


###Example 2: Fuel Gauge
This file demonstrates the simple API of the SparkFun MAX17043 Arduino library.
This file demonstrates the simple API of the SparkFun MAX17043 Arduino library. Make sure you have a LiPo battery plugged into the JST port.

The code for this example can be found in the [Firmware](../Firmware/Example2_FuelGauge/) folder of this repository. Alternatively, you can expand the link below and copy and paste the code into a shiny new Arduino sketch:

You will also need to install the SparkFun MAX1704x Fuel Gauge Arduino Library if you haven't already. You can click the link from within the code or you can download the zip from [the GitHub Repository](https://github.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library/archive/refs/heads/main.zip)
??? "Example 2 Arduino Code"
```
--8<-- "https://github.com/sparkfun/SparkFun_Portability_Shield/raw/refs/heads/main/Firmware/Example2_FuelGauge/Example2_FuelGauge.ino"
```

You will also need to install the SparkFun MAX1704x Fuel Gauge Arduino Library if you haven't already. You can search the library from within the Arduino Library manager, download the zip from [the GitHub Repository](https://github.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library/archive/refs/heads/main.zip) and install it manually, or you can click the link from within the code. Clicking the link will show something like the following:


<figure markdown>
[![SparkFun MAX1704x Fuel Gauge Arduino Library Install](assets/img/MAX17043LibraryInstall.png){ width="90%" }](assets/img/MAX17043LibraryInstall.png "Click to enlarge")
Expand All @@ -50,18 +61,25 @@ Make sure you've selected the correct board and port in the Tools menu and then

###Example 3: Display

This example demonstrates how to display on the 1.3" OLED and read the fuel gauge. You should have the Portability Shield connected to the RTK Postcard or other controller.
This example demonstrates how to display on the 1.3" OLED and read the fuel gauge. You should have the Portability Shield connected to the RTK Postcard or other controller and a LiPo battery plugged into the JST port.

The code for this example can be found in the [Firmware](../Firmware/Example3_Display/) folder of this repository. Alternatively, you can expand the link below and copy and paste the code into a shiny new Arduino sketch:

You will also need to install the SparkFun Qwiic OLED Arduino Library if you haven't already. You can click the link from within the code or you can download the zip from [the GitHub Repository](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/archive/refs/heads/main.zip)
??? "Example 3 Arduino Code"
```
--8<-- "https://raw.githubusercontent.com/sparkfun/SparkFun_Portability_Shield/refs/heads/main/Firmware/Example3_Display/Example3_Display.ino"
```

You will also need both the SparkFun Qwiic OLED Arduino Library as well as the SparkFun MAX1704x Fuel Gauge Arduino Library. If you haven't already installed these, you can search them from within the Arduino Library manager and install them from there. Alternatively, you can download the zips from their respective GitHub Repositories [here(Fuel Gauge)](https://github.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library/archive/refs/heads/main.zip) and [here(Qwiic OLED)](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/archive/refs/heads/main.zip), and install them manually.


Make sure you've selected the correct board and port in the Tools menu and then hit the upload button. Once the code has finished uploading, you should see the gauge's voltage and state-of-charge (SOC) readings, similar to the the output for Example 2.
The 1.3" OLED display should show a bouncing box like so:

Make sure you've selected the correct board and port in the Tools menu and then hit the upload button. Once the code has finished uploading, you should see the gauge's voltage and state-of-charge (SOC) readings, similar to the following:

<figure markdown>
[![Arduino Example 3 Output](assets/img/Example3_Output.jpg){ width="90%" }](assets/img/Example3_Output.jpg "Click to enlarge")
<figcaption markdown>Example 3 Output</figcaption>
[![Arduino Example 3 Output](assets/img/27510-Portability-Shield-GIF.gif){ width="90%" }](assets/img/27510-Portability-Shield-GIF.gif "Click to enlarge")
<figcaption markdown>Example 3</figcaption>
</figure>


Expand All @@ -75,13 +93,19 @@ Go ahead and connect the Portability Shield to the RTK Postcard or other control

The code for this example can be found in the [Firmware](../Firmware/Example4_SD/) folder of this repository. Alternatively, you can expand the link below and copy and paste the code into a shiny new Arduino sketch:

??? "Example 4 Arduino Code"
```
--8<-- "https://github.com/sparkfun/SparkFun_Portability_Shield/raw/refs/heads/main/Firmware/Example4_SD/Example4_SD.ino"
```



You will also need to install the SDFat Arduino Library if you haven't already. You can search the library from within the Arduino Library manager, download the zip from [the GitHub Repository](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/archive/refs/heads/main.zip) and install it manually, or you can click the link from within the code.


Make sure you've selected the correct board and port in the Tools menu and then hit the upload button. Once the code has finished uploading, go ahead and open a [Serial Monitor](https://learn.sparkfun.com/tutorials/terminal-basics) at 115200 baud.
Make sure you've selected the correct board and port in the Tools menu and then hit the upload button. Once the code has finished uploading, go ahead and open a [Serial Monitor](https://learn.sparkfun.com/tutorials/terminal-basics) at 115200 baud. Once you type in any key in the Message Field and send it, the code will analyze the SD card and output something similar to the following:

<figure markdown>
[![Arduino Example 4 Output](assets/img/Example4_Output.jpg){ width="90%" }](assets/img/Example4_Output.jpg "Click to enlarge")
[![Arduino Example 4 Output](assets/img/Example4_Output.png){ width="90%" }](assets/img/Example4_Output.png "Click to enlarge")
<figcaption markdown>Example 4 Output</figcaption>
</figure>
Binary file added docs/assets/img/27510-Portability-Shield-GIF.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/img/Example1_Output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/img/Example2_Output.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/img/Example4_Output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/img/SDFatLibraryInstall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/hardware_assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
icon: fontawesome/solid/screwdriver-wrench
---

The Portability Shield has been designed to be usable with any compatible main board. Here it has shown plugged into the [RTK Postcard](https://www.sparkfun.com/products/26916).
The Portability Shield has been designed to be usable with any compatible main board. Here we have soldered in headers and it is plugged into the [RTK Postcard](https://www.sparkfun.com/products/26916). Note that there is an antenna attached to the module, as well as a LiPo battery plugged into the JST port.


<figure markdown>
Expand Down
5 changes: 4 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ markdown_extensions:
# Allows the use of admonition/call-out boxes
- admonition

# Allows for collapsible admonitions
- pymdownx.details

# Allows the use of Markdown syntax in HTML elements
- md_in_html

Expand Down Expand Up @@ -362,7 +365,7 @@ nav:
- Hardware Overview: hardware_overview.md
- Hardware Assembly: hardware_assembly.md
# - Software Setup: software_setup-arduino.md
# - Examples: arduino_example.md
- Arduino Examples: arduino_example.md
- Resources: resources.md
- Support:
- Troubleshooting: troubleshooting.md
Expand Down

0 comments on commit eef59f4

Please sign in to comment.