Although the new display won’t be functional, the Arduino code should compile and run without error. The Console app should also compile and run and Displays option should include the new display and when selected run to completion without it generating any errors. The Arduino app should respond correctly to it including rebooting upon completion of the console app.

As stated previously: The “shell” Softata code for the Bargraph Display has been implemented. This includes code in the Arduino sketch as well as in the minimal mirroring code in SoftataLib. _The Console app did not require any new code. The shell code does not implement the required functionality, but includes empty methods that return true where the functionality can be implemented. The Arduino sketch builds and runs without error with these additions. The C# SoftataLib code compiles and the display can be chosen in the Console app where the app runs and completes without error. A comparison was made of the repository before and after the addition of the “shell” code for the display and can be viewed here_

The object of this specific exercise is to provide a template for adding devices, specifically for adding displays to Softata.

The previous post covered display for a new display. This post covers a simple test of the updated code.

This Test does not require the display to built and connected.

2. The Arduino Kketch

  • Open the project in the Arduino IDE. Do a check build and resolve any issues.
  • Run the sketch on the Pico W and note (if not done already) its IpAddress and Port.
  • When booted, the in built LED should flash slowly: 4 sec on, 4 sec off.
  • In the Serial Monitor you should get something like:
==== 2nd Core Started ====
Connecting to 'MyNetwork' with 'MyPwd'
........................................................
Connected to WiFi

Connect to server at 192.168.0.9:4242
Initial Core1-Core2 Synch value:137
==== 2nd Core Ready ====
Core1-Core2 Setup Sync OK

This means that it has booted OK and the two cores have synched. It has an IPAddress as above using the Port as above. The Port can be changed in Softata.h. Also Azure IoT Hub is not enabled.

To enable Azure IoT Hub functionality (not needed for this basic test) uncomment the following in Softata.h:

//#define USINGIOTHUB

… But you need to have setup and IoT Hub and Device and included it connection details in Softata.h

This though slows the Pico boot process. An example of the boot message thus is:

==== 2nd Core Started ====
Connecting to 'MyNetwork' with 'MyPwd'
........................................................
Connected to WiFi

Connect to server at 192.168.0.9:4242
Initial Core1-Core2 Synch value:137

Connecting to WIFI SSID MyNetwork
Core 2 WiFi connected, IP address: 192.168.0.9
Setting time using SNTP...done!
Current time: Sun Mar 10 02:15:38 2024
MQTT connecting ... connected.
==== 2nd Core Ready ====
Core1-Core2 Setup Sync O

3. The Console App

  • Open the C# solution and set the IpAddress and port in the console app.
  • Run the console app. You get a menu:
Hello from Soft-ata!

TESTS
1.              DigitalButtonLED
2.              AnalogPotLED
3.              PWM
4.              Servo
5.              Sensors
6.              Displays
...
...
  • Select option 6. Displays
Displays found:
1.              OLED096
2.              LCD1602
3.              NEOPIXEL
4.              BARGRAPH

The BARGRAPH display shows.

  • Enter 4 to select it

You get its connect information:

Received OK:16 (DS of 74HC595-Pin14),18 (ST_CP of 74HC595-Pin12),20 (SH_CP of 74HC595-Pin11)(default) [92] bytes

The Display does not need to be connected here.

  • Press [Enter] and the Console app runs to completion without errors. In so doing it sends “Done” to the Pico which causes it to reboot.

All good! :)

Next: A Running Bargraph


 TopicSubtopic
   
 This Category Links 
Category:Softata Index:Softata
  Next: > Softata - Adding a new display
<  Prev:   Softata - Adding a new display