parasitize
to live on, in, or with another organism (the host) while feeding off it and causing harm
parasitize
to live on, in, or with another organism (the host) while feeding off it and causing harm
#define LDRpin A0 int LDRValue = 0; int LDRBefore = 0; int LDRCount = 0; // NEW int MotorRot = 0; // NEW int LedPin = 13; // NEW void setup() { Serial.begin(9600); pinMode(13, OUTPUT); digitalWrite(13, HIGH); // NEW } void loop() { LDRValue = analogRead(LDRpin); delay(1); /* Serial.print("LDRValue: "); // NEW Serial.println(LDRValue); Serial.print(" LDRBefore: "); Serial.print(LDRBefore); Serial.print(" LDRCount: "); Serial.print(LDRCount); Serial.print(" MotorRot: ");*/ Serial.println(MotorRot); if (LDRValue < LDRBefore) // NEW { LDRValue = LDRValue + 250; if (LDRValue <= LDRBefore) { LDRValue = LDRValue - 250; LDRCount = ++LDRCount; if (LDRCount == 20) { LDRCount = 0; MotorRot = ++MotorRot; } } else { LDRValue = LDRValue - 250; } } LDRBefore = LDRValue; }Attachments
code
#define LDRpin A0 int LDRValue = 0; int LedPin = 13; // NEW void setup() { Serial.begin(9600); pinMode(13, OUTPUT); // NEW digitalWrite(13, LOW); // NEW } void loop() { LDRValue = analogRead(LDRpin); Serial.println(LDRValue); delay(2); if (LDRValue > 300) // NEW { digitalWrite(LedPin, LOW); } else { digitalWrite(LedPin, HIGH); } }
code
#define LDRpin A0 int LDRValue = 0; void setup() { Serial.begin(9600); } void loop() { LDRValue = analogRead(LDRpin); Serial.println(LDRValue); delay(2); }
code
void setup() { pinMode(LED_BUILTIN, OUTPUT); } void loop() { int sensorValue = analogRead(A0); if (sensorValue > 700) { digitalWrite(LED_BUILTIN, HIGH); } else { digitalWrite(LED_BUILTIN, LOW); } delay(10); }
sketch code