Example Code for Arduino-Testing UV Sensor

Last revision 2025/12/26

This Sample code is for testing the UV Sensor .

Hardware Preparation

  • UV Sensor (TOY0044): 1 pc
  • Arduino Board: 1 pc
  • Jumper Wires: Several

Wiring Diagram

TOY0044

Sample Code

/*
# This Sample code is for testing the UV Sensor .
#Connection:
    VCC-5V
    GND-GND
    OUT-Analog pin 0
*/

void setup()
{
  Serial.begin(9600);// open serial port, set the baud rate to 9600 bps
}
void loop()
{
  int sensorValue;
  sensorValue = analogRead(0);//connect UV sensors to Analog 0
  Serial.println(sensorValue);//print the value to serial
  delay(200);
}

Was this article helpful?

TOP