Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

UV sensor X 3

$
0
0
So we are doing a project where we gonna use 3 UV sensors.
 
I was just wondering how can we use the code more than one time?
Like how can we triple it?
 
this is the code.  
 
 
/*
  AnalogReadSerial
  Reads an analog input on pin A3, prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A3, and the outside pins to ~3V and ground.
  
  Hardware Required:
  * MSP-EXP430G2 LaunchPad
  * 10-kilohm Potentiometer
  * hook-up wire


  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 A3:
  int sensorValue = analogRead(A1)* (3.3/4096.0); 
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1); // delay in between reads for stability
}

Viewing all articles
Browse latest Browse all 2077

Trending Articles