Skip to content

Instantly share code, notes, and snippets.

@soundanalogous
Created April 10, 2016 07:44
Show Gist options
  • Save soundanalogous/155ae5a1f9d3d1d72b8162cc3cbf5de7 to your computer and use it in GitHub Desktop.
Save soundanalogous/155ae5a1f9d3d1d72b8162cc3cbf5de7 to your computer and use it in GitHub Desktop.
config file to accompany StandardFirmataESP.ino
/*==============================================================================
* NETWORK CONFIGURATION
*
* You must configure your particular hardware. Follow the steps below.
*
* Currently StandardFirmataEthernet is configured as a client. An option to
* configure as a server may be added in the future.
*============================================================================*/
// STEP 1 [REQUIRED]
// Uncomment / comment the appropriate set of includes for your hardware (OPTION A or B)
// Option A is enabled by default.
/*
* OPTION A: Configure for Arduino Ethernet board or Arduino Ethernet shield (or clone)
*
* To configure StandardFirmataEthernet to use the original WIZ5100-based
* ethernet shield or Arduino Ethernet uncomment the WIZ5100_ETHERNET define below
*/
//#define WIZ5100_ETHERNET
#ifdef WIZ5100_ETHERNET
#include <SPI.h>
#include <Ethernet.h>
EthernetClient client;
#endif
/*
* OPTION B: Configure for Arduin Yun
*
* The Ethernet port on the Arduino Yun board can be used with Firmata in this configuration.
*
* To execute StandardFirmataEthernet on Yun uncomment the YUN_ETHERNET define below and make
* sure the WIZ5100_ETHERNET define (above) is commented out.
*
* On Yun there's no need to configure local_ip and mac address as this is automatically
* configured on the linux-side of Yun.
*/
//#define YUN_ETHERNET
#ifdef YUN_ETHERNET
#include <Bridge.h>
#include <YunClient.h>
YunClient client;
#endif
#define ESP8266_WIFI
#ifdef ESP8266_WIFI
#include <ESP8266WiFi.h>
WiFiClient client;
char ssid[] = "your_ssid";
char wpa_passphrase[] = "your_wpa_passphrase";
#endif
// STEP 2 [REQUIRED for all boards and shields]
// replace with IP of the server you want to connect to, comment out if using 'remote_host'
#define remote_ip IPAddress(10, 0, 0, 2)
// *** REMOTE HOST IS NOT YET WORKING ***
// replace with hostname of server you want to connect to, comment out if using 'remote_ip'
// #define remote_host "server.local"
// STEP 3 [REQUIRED unless using Arduin Yun]
// Replace with the port that your server is listening on
#define remote_port 3030
// STEP 4 [REQUIRED unless using Arduino Yun OR if not using DHCP]
// Replace with your board or ethernet shield's IP address
// Comment out if you want to use DHCP
//#define local_ip IPAddress(10, 0, 0, 15)
// STEP 5 [REQUIRED unless using Arduino Yun]
// replace with ethernet shield mac. Must be unique for your network
const byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x53, 0xE5};
/*==============================================================================
* CONFIGURATION ERROR CHECK (don't change anything here)
*============================================================================*/
//#if !defined WIZ5100_ETHERNET && !defined YUN_ETHERNET
//#error "you must define either WIZ5100_ETHERNET or YUN_ETHERNET in ethernetConfig.h"
//#endif
#if defined remote_ip && defined remote_host
#error "cannot define both remote_ip and remote_host at the same time in ethernetConfig.h"
#endif
/*==============================================================================
* PIN IGNORE MACROS (don't change anything here)
*============================================================================*/
// ignore SPI pins, pin 10 (Ethernet SS) and pin 4 (SS for SD-Card on Ethernet shield)
#define IS_IGNORE_ETHERNET_SHIELD(p) ((IS_PIN_SPI(p) || (p) == 4) || (p) == 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment