Camp Portal

If you have any questions or suggestions, email us at contact@themarsfund.org 

We are more than happy to help

Getting Started

To continue programming at home, you will need the Arduino IDE(Integrated Development Environment). This is where you type your code run it.   If you are on a Chromebook, Arduino has an online version as well.

or

Here's a video to help install the IDE

CAD

You can install AutoDesk Inventor for free at the link below. The file is very big (~15 gb) so it can take a while. 

CODE DAY 2

#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11
int Steps = 0;
boolean Direction = true;
int stepsRequired = 0;
int angle =  30;
void setup() {
 Serial.begin(9600);
 pinMode(IN1, OUTPUT);
 pinMode(IN2, OUTPUT);
 pinMode(IN3, OUTPUT);
 pinMode(IN4, OUTPUT);
}
void loop() {
 runToAngle(angle);
}
void runToAngle(int angle){
 stepsRequired = (angle*11);
 Serial.println(stepsRequired);

 for(int i=0; i<stepsRequired; i++){
   stepper(1);
   delayMicroseconds(800);
 }
 Direction = !Direction;
}
void stepper(int xw) {
 for (int x = 0; x < xw; x++) {
   switch (Steps) {
     case 0:
     digitalWrite(IN1, LOW);
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
     break;
     case 1:
     digitalWrite(IN1, LOW);
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, HIGH);
     break;
     case 2:
     digitalWrite(IN1, LOW);
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
     break;
     case 3:
     digitalWrite(IN1, LOW);
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
     break;
     case 4:
     digitalWrite(IN1, LOW);
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
     break;
     case 5:
     digitalWrite(IN1, HIGH);
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
     break;
     case 6:
     digitalWrite(IN1, HIGH);
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
     break;
     case 7:
     digitalWrite(IN1, HIGH);
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
     break;
     default:
     digitalWrite(IN1, LOW);
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
     break;
   }
 SetDirection();
 }
}
void SetDirection() {
 if (Direction == 1) {
   Steps++;
}
 if (Direction == 0) {
    Steps--;
 }
 if (Steps > 7) {
   Steps = 0;
 }
 if (Steps < 0) {
   Steps = 7;
 }
}

 

 
 

Mason Accelerator For Robotics and Science Fund, Inc

For inquires, email contact@themarsfund.org

Copyright © 2017-2019 Mason Accelerator For Robotics and Science Fund, Inc. All rights reserved