Getting started with Xinabox programming

From Design and Build Lab
Jump to navigation Jump to search

This page is part of a series of pages connected with the American University Space Agency, a project to send small sensors into space. It is made possible with the generous help of VASpace, Twiggs Space Labs, Xinabox, and the DC NASA Space Grant Consortium, and AU's Institute for Integrated Space Science and Technology (ISSTI).


First-time setup

  1. Download and install the Arduino IDE.
  2. Open the Arduino IDE.
  3. Navigate to File --> Preferences.
    1. In the Settings tab, add the following to the "Additional Boards Manager URLs" box:
      http://arduino.esp8266.com/stable/package_esp8266com_index.json
  4. Close Preferences.
  5. Navigate to Tools --> Board: --> Boards Manager
    1. In the search box, type: esp8266
    2. Install the "esp8266 by ESP8266 Community" definitions.

General programming of the board

Select the board

  1. Navigate to Tools --> Board:
    1. Select "Generic ESP8266 Module"

Select the board parameters

  1. Navigate to Tools --> Port:
    1. Select the correct COM port (Windows) or /dev/* port (unix flavors)
  2. Navigate to Tools --> Flash Mode
    1. Select "DIO"

Hardware test code

  1. Copy and paste the code (below) into the Arduino IDE.
  2. Press "Upload".
    1. If successful, when this is done uploading:
      • the LEDs on the CW01 will continually flash red, then green, and then blue.
      • the Serial Monitor (Tools --> Serial Monitor) should print the pin of the currently-lit LED.

/* Xinabox Weathersat Basic Hardware Test
 * Description: test hardware setup of Xinabox CW01 plus IP01
 * Author: Kristof Aldenderfer
 */

byte led_pins[3] = {12, 13, 5};                                         // RED, GREEN, and BLUE pins, respectively
int delay_time = 100;                                                   // delay time, used to blink the leds

// set runs only once, when the hardware is first powered
void setup() {
  for (byte i = 0 ; i < sizeof(led_pins)/sizeof(led_pins[0]) ; i++) {   // for each pin in the led pin array:
    pinMode(led_pins[i], OUTPUT);                                       // Initialize the led pin as an output
  }
  Serial.begin(115200);                                                 // initialize the Serial Monitor for debugging
}

// loop runs forever
void loop() {
  for (byte i = 0 ; i < sizeof(led_pins)/sizeof(led_pins[0]) ; i++) {   // for each pin in the led pin array:
    Serial.println(led_pins[i]);                                        // print the pin number
    digitalWrite(led_pins[i], HIGH);                                    // turn the led on
    delay(delay_time*4);                                                // wait
    digitalWrite(led_pins[i], LOW);                                     // turn the led off
    delay(delay_time);                                                  // wait
  }
}

(Some information taken from here, here, and here.)