[224] | 1 | /*==============================================================================
|
---|
| 2 | * NETWORK CONFIGURATION
|
---|
| 3 | *
|
---|
| 4 | * You must configure your particular hardware. Follow the steps below.
|
---|
| 5 | *
|
---|
| 6 | * Currently StandardFirmataEthernet is configured as a client. An option to
|
---|
| 7 | * configure as a server may be added in the future.
|
---|
| 8 | *============================================================================*/
|
---|
| 9 |
|
---|
| 10 | // STEP 1 [REQUIRED]
|
---|
| 11 | // Uncomment / comment the appropriate set of includes for your hardware (OPTION A or B)
|
---|
| 12 | // Option A is enabled by default.
|
---|
| 13 |
|
---|
| 14 | /*
|
---|
| 15 | * OPTION A: Configure for Arduino Ethernet board or Arduino Ethernet shield (or clone)
|
---|
| 16 | *
|
---|
| 17 | * To configure StandardFirmataEthernet to use the original WIZ5100-based
|
---|
| 18 | * ethernet shield or Arduino Ethernet uncomment the WIZ5100_ETHERNET define below
|
---|
| 19 | */
|
---|
| 20 | #define WIZ5100_ETHERNET
|
---|
| 21 |
|
---|
| 22 | #ifdef WIZ5100_ETHERNET
|
---|
| 23 | #include <SPI.h>
|
---|
| 24 | #include <Ethernet.h>
|
---|
| 25 | EthernetClient client;
|
---|
| 26 | #endif
|
---|
| 27 |
|
---|
| 28 | /*
|
---|
| 29 | * OPTION B: Configure for Arduin Yun
|
---|
| 30 | *
|
---|
| 31 | * The Ethernet port on the Arduino Yun board can be used with Firmata in this configuration.
|
---|
| 32 | *
|
---|
| 33 | * To execute StandardFirmataEthernet on Yun uncomment the YUN_ETHERNET define below and make
|
---|
| 34 | * sure the WIZ5100_ETHERNET define (above) is commented out.
|
---|
| 35 | *
|
---|
| 36 | * On Yun there's no need to configure local_ip and mac address as this is automatically
|
---|
| 37 | * configured on the linux-side of Yun.
|
---|
| 38 | */
|
---|
| 39 | //#define YUN_ETHERNET
|
---|
| 40 |
|
---|
| 41 | #ifdef YUN_ETHERNET
|
---|
| 42 | #include <Bridge.h>
|
---|
| 43 | #include <YunClient.h>
|
---|
| 44 | YunClient client;
|
---|
| 45 | #endif
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | // STEP 2 [REQUIRED for all boards and shields]
|
---|
| 49 | // replace with IP of the server you want to connect to, comment out if using 'remote_host'
|
---|
| 50 | #define remote_ip IPAddress(10, 0, 0, 3)
|
---|
| 51 | // *** REMOTE HOST IS NOT YET WORKING ***
|
---|
| 52 | // replace with hostname of server you want to connect to, comment out if using 'remote_ip'
|
---|
| 53 | // #define remote_host "server.local"
|
---|
| 54 |
|
---|
| 55 | // STEP 3 [REQUIRED unless using Arduin Yun]
|
---|
| 56 | // Replace with the port that your server is listening on
|
---|
| 57 | #define remote_port 3030
|
---|
| 58 |
|
---|
| 59 | // STEP 4 [REQUIRED unless using Arduino Yun OR if not using DHCP]
|
---|
| 60 | // Replace with your board or ethernet shield's IP address
|
---|
| 61 | // Comment out if you want to use DHCP
|
---|
| 62 | #define local_ip IPAddress(10, 0, 0, 15)
|
---|
| 63 |
|
---|
| 64 | // STEP 5 [REQUIRED unless using Arduino Yun]
|
---|
| 65 | // replace with ethernet shield mac. Must be unique for your network
|
---|
| 66 | const byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x53, 0xE5};
|
---|
| 67 |
|
---|
| 68 | /*==============================================================================
|
---|
| 69 | * CONFIGURATION ERROR CHECK (don't change anything here)
|
---|
| 70 | *============================================================================*/
|
---|
| 71 |
|
---|
| 72 | #if !defined WIZ5100_ETHERNET && !defined YUN_ETHERNET
|
---|
| 73 | #error "you must define either WIZ5100_ETHERNET or YUN_ETHERNET in ethernetConfig.h"
|
---|
| 74 | #endif
|
---|
| 75 |
|
---|
| 76 | #if defined remote_ip && defined remote_host
|
---|
| 77 | #error "cannot define both remote_ip and remote_host at the same time in ethernetConfig.h"
|
---|
| 78 | #endif
|
---|
| 79 |
|
---|
| 80 | /*==============================================================================
|
---|
| 81 | * PIN IGNORE MACROS (don't change anything here)
|
---|
| 82 | *============================================================================*/
|
---|
| 83 |
|
---|
| 84 | // ignore SPI pins, pin 10 (Ethernet SS) and pin 4 (SS for SD-Card on Ethernet shield)
|
---|
| 85 | #define IS_IGNORE_ETHERNET_SHIELD(p) ((IS_PIN_SPI(p) || (p) == 4) || (p) == 10)
|
---|