Guten Abend, ich muss mit den UV-sensor GUVA -S12sd ich wollte ihm mit diesem :
void setup() {
Serial.begin(9600);
}
void loop() {
float sensorVoltage;
float sensorValue;
float UVIndex;
float Index;
float sensorResponsivity;
sensorValue = analogRead(A0);
sensorVoltage = sensorValue/1024*5.0*1000;
UVIndex = Index;
sensorResponsivity = 1/sensorVoltage;
if(sensorVoltage < 50)
{
Index = 0;
}
if(49 < sensorVoltage < 228)
{
Index = 1;
}
if(227 < sensorVoltage < 319)
{
Index = 2;
}
if(318 < sensorVoltage < 409)
{
Index = 3;
}
if(408 < sensorVoltage < 504)
{
Index = 4;
}
if(503 < sensorVoltage < 607)
{
Index = 5;
}
if(606 < sensorVoltage < 697)
{
Index = 6;
}
if(696 < sensorVoltage < 796)
{
Index = 7;
}
if(795 < sensorVoltage < 882)
{
Index = 8;
}
if(881 < sensorVoltage < 977)
{
Index = 9;
}
if(976 < sensorVoltage < 1080)
{
Index = 10;
}
if(1079 < sensorVoltage < 1171)
{
Index = 11;
}
if(1170 < sensorVoltage)
{
Index = 12; //Index = 11+
}
}
Serial.print("sensor reading = ");
Serial.print(sensorValue);
Serial.print(" sensor voltage = ");
Serial.print(sensorVoltage);
Serial.print(" mV");
Serial.print(" UV-Index = ");
Serial.print(UVIndex);
Serial.print(" sensor Responsivity = ");
Serial.println(sensorResponsivity);
delay(1000);
}
Nach ausführen kam es auf dem Arduino Uno zur Fehlermeldung "serial does not named a type" Weiß jemand vieleicht wo mein Fehler liegt.
Vielen Dank im Voraus.