Week 8 Input Devices
✅ group assignment: probe an input device's analog levels and digital signals
Different digital and analog signals with the Saleae logic analizer, magnetometer, and the oscilloscope.
✅ individual assignment: measure something: add a sensor to a microcontroller board that you have designed and read it
For week 8 I programed a infrared sensor, potentially using it as a limit switch for machines
// Define a variable for the pin number
int sensorPin = D3;
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud
pinMode(sensorPin, INPUT_PULLUP);
// Using INPUT_PULLUP so that the internal pull-up resistor is enabled.
// If the pin is connected to a button that goes to ground, it will read LOW when pressed.
}
void loop() {
int sensorValue = digitalRead(sensorPin); // Read the value from the pin
Serial.print("Pin ");
Serial.print(sensorPin);
Serial.print(" state: ");
Serial.println(sensorValue); // Print the pin state (0 or 1)
delay(100); // Wait half a second for readability
}
Joystick
I made a joy stick to control the microscope stage of the Raman spectrometer, Marcello was a big help during this part.