Category: Stem Toys India

Line Tracking Code Curiblox

#include <AFMotor.h>

AF_DCMotor Motor1(1); // Motor on M1
const int irPin = A2; // Analog pin

int threshold = 400; // Between white (32) and black (769)

void setup() {
Serial.begin(9600);
Motor1.setSpeed(200);
Motor1.run(RELEASE);
}

void loop() {

int irValue = analogRead(irPin);
Serial.print(“IR Value: “);
Serial.println(irValue);

// Your sensor:
// WHITE = low value (31)
// BLACK = high value (769)

if (irValue > threshold) {
// BLACK detected → run motor
Motor1.run(FORWARD);
} else {
// WHITE or air → stop motor
Motor1.run(RELEASE);
}

delay(10);
}

Write a Review

Your email address will not be published. Required fields are marked *

Hand Gesture Code Arduino Curiblox

#include <AFMotor.h> AF_DCMotor Motor1(1); // Motor on M1 const int irPin =.

Edge Detection or Anti Fall code curiblox

#include <AFMotor.h> AF_DCMotor Motor1(1); // Motor on M1 const int irPin =.

Object avoidance code curiblox

#include <AFMotor.h> AF_DCMotor Motor1(1); // Motor on M1 const int irPin =.

hand-gesture-code-curiblox

#include <AFMotor.h> AF_DCMotor Motor1(1); // Motor on M1 const int irPin =.

Curiblox: India’s Home for Hands-On STEM Toys, STEM

#include <AFMotor.h> AF_DCMotor Motor1(1); // Motor on M1 const int irPin =.

Item 0.00
Loadding...