Close

Week 8

A project log for Dynamic Interactive - Urbanscapes

This is a school project that follows Urbanscapes Malaysia brief, to create an interactive design related to Malaysia art and culture.

aprilmomo0416aprilmomo0416 12/20/2018 at 03:160 Comments

8th Nov, 2018-Thursday

Alpha Test

- Keep continue doing our little props.

- Working on the mechanism, testing out the input and output is functioning correctly.

What can we improve?:

Code for Alpha test:

const int BtnSmallMotor = 2;
const int TouchSense = 4;
const int TouchHorse = 12;

const int SmallMotorSpin = 6;
const int LargeMotorSpin = 8;
const int LightUp = 10;


int buttonState = 0;
int touchy =0;
int touchDaHorse =0;


void setup() {
  // put your setup code here, to run once:
pinMode (BtnSmallMotor,INPUT);
pinMode (TouchSense,INPUT);
digitalWrite(TouchSense,HIGH);
pinMode (TouchHorse,INPUT);
digitalWrite(TouchHorse,HIGH);

pinMode (SmallMotorSpin,OUTPUT);
pinMode (LargeMotorSpin,OUTPUT);
pinMode (LightUp,OUTPUT);

//digitalWrite(SwitchPin, HIGH); VERY IMPORTANTTTT
Serial.begin (9600);
digitalWrite(LightUp,LOW);
}



void loop(){

  buttonState = digitalRead(BtnSmallMotor);
     
  if (buttonState == LOW){
    digitalWrite (SmallMotorSpin,LOW);
  } else
  if (buttonState == HIGH){
    digitalWrite (SmallMotorSpin, HIGH);
    delay(1800);
  }

  touchy = digitalRead (TouchSense);
  if(touchy == LOW){
      digitalWrite(LightUp,LOW);
    } else {
      digitalWrite(LightUp,HIGH);
    }
  
  touchDaHorse = digitalRead (TouchHorse);

  if(touchDaHorse == HIGH){
    analogWrite(LargeMotorSpin,50);
    }
    else {
    analogWrite (LargeMotorSpin,0);
    }
  
}
  // put your main code here, to run repeatedly:

Discussions