Jump to content
43oh

SamSMK

Members
  • Content Count

    5
  • Joined

  • Last visited

Reputation Activity

  1. Like
    SamSMK reacted to abecedarian in UV sensor X 3   
    Could do something like this:

    /* Triple AnalogReadSerial based on AnalogReadSerial Reads analog inputs on pins A1, A2 and A3, prints the results to the serial monitor. Attach the center pins of potentiometers to pins A1, A2 and A3, and the outside pins to ~3V and ground. Hardware Required: * MSP-EXP430G2 LaunchPad * Three 10-kilohm Potentiometers * hook-up wires This example code is in the public domain. */ // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // msp430g2231 must use 4800 } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin A1: int sensorValue1 = analogRead(A1)* (3.3/4096.0); // print out the value you read: Serial.println("Sensor 1 value: "); Serial.println(sensorValue1); // read the input on analog pin A2: int sensorValue2 = analogRead(A2)* (3.3/4096.0); // print out the value you read: Serial.println("Sensor 2 value: "); Serial.println(sensorValue2); // read the input on analog pin A3: int sensorValue3 = analogRead(A3)* (3.3/4096.0); // print out the value you read: Serial.println("Sensor 3 value: "); Serial.println(sensorValue3); delay(500); // delay in between reads for stability and readability }
×
×
  • Create New...