Difference between revisions of "Getting started with Xinabox programming"
Jump to navigation
Jump to search
(fix formatting) |
(→Hardware test code) |
||
(One intermediate revision by the same user not shown) | |||
Line 30: | Line 30: | ||
## If successful, when this is done uploading: | ## If successful, when this is done uploading: | ||
##* the LEDs on the CW01 will continually flash red, then green, and then blue. | ##* 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. |
---- | ---- | ||
Line 55: | Line 55: | ||
for (byte i = 0 ; i < sizeof(led_pins)/sizeof(led_pins[0]) ; i++) { // for each pin in the led pin array: | 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 | Serial.println(led_pins[i]); // print the pin number | ||
− | digitalWrite( | + | digitalWrite(led_pins[i], HIGH); // turn the led on |
delay(delay_time*4); // wait | delay(delay_time*4); // wait | ||
− | digitalWrite( | + | digitalWrite(led_pins[i], LOW); // turn the led off |
delay(delay_time); // wait | delay(delay_time); // wait | ||
} | } |
Latest revision as of 19:19, 6 December 2018
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).
Contents
First-time setup
- Download and install the Arduino IDE.
- Open the Arduino IDE.
- Navigate to File --> Preferences.
- In the Settings tab, add the following to the "Additional Boards Manager URLs" box:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
- In the Settings tab, add the following to the "Additional Boards Manager URLs" box:
- Close Preferences.
- Navigate to Tools --> Board: --> Boards Manager
- In the search box, type:
esp8266
- Install the "esp8266 by ESP8266 Community" definitions.
- In the search box, type:
General programming of the board
Select the board
- Navigate to Tools --> Board:
- Select "Generic ESP8266 Module"
Select the board parameters
- Navigate to Tools --> Port:
- Select the correct COM port (Windows) or /dev/* port (unix flavors)
- Navigate to Tools --> Flash Mode
- Select "DIO"
Hardware test code
- Copy and paste the code (below) into the Arduino IDE.
- Press "Upload".
- 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.
- If successful, when this is done uploading:
/* 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 } }