Skip to content

4 25 18 meeting notes

Max Lever edited this page Apr 28, 2018 · 5 revisions

Wednesday, April 25th, 2018

I2C Communication

Wrote and tested code for inter-arduino communication.

This code sends a 0 when proximity sensor detects that something is at a certain distance and 1 if not. This is the master machine.

#include <Wire.h>
/**
   sensor
*/
const int anPin = 1;
long anVolt, mm, inches;


void setup() {
  Wire.begin(); // join i2c bus (address optional for master)
}


void loop() {
  read_sensor();
  print_range();
  if (inches > 20 && inches < 40) {
    Wire.beginTransmission(8);
    Wire.write(0);           
    Wire.endTransmission();  
  } else {
    Wire.beginTransmission(8);
    Wire.write(1);           
    Wire.endTransmission();  
  }

  delay(30);
}

void read_sensor () {
  anVolt = analogRead(anPin);
  mm = anVolt * 5;
  inches = mm / 25.4;
}

void print_range () {
  Serial.println(inches);
}

This code lights up an LED when it receives a 0 message. This is the slave machine.

#include <Wire.h>
int ledPin = 3;

void setup() {
  pinMode(ledPin, OUTPUT);

  Wire.begin(8);                
  Wire.onReceive(receiveEvent);
  Serial.begin(9600);           
    analogWrite(ledPin, 200);
    analogWrite(ledPin, 0);
}

void loop() {
  delay(50);
}

void receiveEvent(int howMany) {
  int x = Wire.read();    
  if (x == 0) {
    analogWrite(ledPin, 200);
  } else {
    analogWrite(ledPin, 0);
  }

  Serial.println(x);         
}

Scouting out location

Once the rest of the senior show was setup we looked at the space we had left and how our piece would fit in.

last minute changes

Today, we learn, at 4pm, that we are not allowed to attach or hang our frame from the ceiling or attach anything heavy to the wall, or otherwise do anything which "seems like construction" or "looks heavy duty".

We went back and forth with chris franson and doug scott about ideas:

  • shelf (rejected: too much attachment to wall, "need heavy duty anchors")
  • half-shelf (rejected, still attached to wall)
  • freestanding PVC / wood (accepted)

Finally, we decided on 8x3x3 PVC structure and the frame can stand inside and be held by planks sitting on box. like this: but not this, because too small

Clone this wiki locally