Difference between revisions of "Programming the blue board"

From Mech
Jump to navigationJump to search
(Created page with "Back to Northwestern Design Competition == Programming the blue board == The DC2015 Control Board is based on the [http://www.digilentinc.com/Products/Detail.cfm?Prod=CHI...")
 
Line 19: Line 19:


== Example 1: Blink ==
== Example 1: Blink ==


<pre>

void setup() {
Serial.begin(9600);
pinMode(PIN_LED1, OUTPUT);
}

void loop() {
Serial.println("Hello!");
if (digitalRead(17)==1) {
digitalWrite(PIN_LED1, HIGH); // set the LED on
}
else {
digitalWrite(PIN_LED1, LOW); // set the LED off
}
delay(100); // wait for 100ms
}

</pre>


== Example 2: Analog input, serial output ==
== Example 2: Analog input, serial output ==

Revision as of 19:52, 24 February 2015

Back to Northwestern Design Competition

Programming the blue board

The DC2015 Control Board is based on the chipKIT DP32 by Digilent.

It is programmed via the Multi Platform IDE - MPIDE. Download and install the latest MPIDE for your platform.

Plug in your blue board. The red Power LED should be lit, and the green LD1 LED should be blinking. When blinking, the board is ready to be programmed. To run code that you have uploaded, press and hold the Reset button, press and hold the User button, release the Reset button, then release the User button.

Communication Ports

  • On Windows
  • On Mac

Coding

MPIDE contains many example programs: try Files -> Examples -> Basics -> Blink

The example programs look a lot like Arduino programs, and the environment is very similar. The main difference is that the examples may not use pins that the blue board has, so be sure to explicitly define your pins.

Example 1: Blink


void setup() {
  Serial.begin(9600);
  pinMode(PIN_LED1, OUTPUT);
}

void loop() {
  Serial.println("Hello!");
  
  if (digitalRead(17)==1) {
    digitalWrite(PIN_LED1, HIGH); // set the LED on
  }
  else {
    digitalWrite(PIN_LED1, LOW); // set the LED off
  }
  
  delay(100); // wait for 100ms
}

Example 2: Analog input, serial output

Example 3: RC Servo

You will need to wire up an RC servo by following building the black board