Skip to content

Commit

Permalink
Merge pull request #13 from DCC-EX:fix-examples
Browse files Browse the repository at this point in the history
Fix-examples
  • Loading branch information
peteGSX authored Dec 5, 2023
2 parents 270bb9b + 6c9fecc commit 04a4d38
Show file tree
Hide file tree
Showing 18 changed files with 489 additions and 513 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ examples/*/.vscode/*.*
examples/*/.gitignore
examples/*/platform.ini

examples/*/myWiFi.h
examples/*/config.h

# Documentation build folders
build
Expand Down
17 changes: 8 additions & 9 deletions examples/DCCEXProtocol_Basic/DCCEXProtocol_Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include <WiFi.h>
#include <DCCEXProtocol.h>

// WiFi and server configuration
// const char* ssid = "MySSID";
// const char* password = "MyPWD";
const char* ssid = "DCCEX_1ec919";
const char* password = "PASS_1ec919";
IPAddress serverAddress(192,168,4,1);
int serverPort = 2560;
// If we haven't got a custom config.h, use the example
#if __has_include ("config.h")
#include "config.h"
#else
#warning config.h not found. Using defaults from config.example.h
#include "config.example.h"
#endif

// Global objects
WiFiClient client;
Expand All @@ -42,8 +42,7 @@ void setup() {
}
Serial.println("Connected to the server");

// Uncomment for logging on Serial
//dccexProtocol.setLogStream(&Serial);
dccexProtocol.setLogStream(&Serial);

// Pass the communication to wiThrottleProtocol
dccexProtocol.connect(&client);
Expand Down
7 changes: 7 additions & 0 deletions examples/DCCEXProtocol_Basic/config.example.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Example user configuration to use with the DCCEXProtocol examples
// Copy this file and rename to config.h
// Replace the variables below with the appropriate values for your environment
const char* ssid = "YOUR_SSID_HERE"; // WiFi SSID name here
const char* password = "YOUR_PASSWORD_HERE"; // WiFi password here
IPAddress serverAddress(192,168,4,1); // IP address of your EX-CommandStation
int serverPort = 2560; // Network port of your EX-CommandStation

This file was deleted.

Loading

0 comments on commit 04a4d38

Please sign in to comment.