@thinknmake_admin
hello testing
Maker community
Share what you built — photos, video, the code and the part that nearly didn’t work. Every post here started with someone’s first blinking LED.
Log in to share what you’re building.
@thinknmake_admin
@swekar
@maker_samrat
@aarav_builds
// PID line following — the values that finally worked for me
const float Kp = 0.08, Ki = 0.0002, Kd = 0.9;
int baseSpeed = 140; // was 200 — too fast for the hairpin
void loop() {
int error = readLinePosition() - 3500; // 0..7000, centre = 3500
integral += error;
int correction = Kp * error + Ki * integral + Kd * (error - lastError);
lastError = error;
// Slow down when we are far off the line; speed up on the straights.
int speed = baseSpeed - min(abs(error) / 40, 60);
setMotors(speed + correction, speed - correction);
}@diya_makes
@team_innovators
@kabir_m
@sneha_codes
// Non-blocking debounce — no delay(), the loop stays responsive.
class Button {
uint8_t pin; bool stable = HIGH, last = HIGH; unsigned long changedAt = 0;
public:
explicit Button(uint8_t p) : pin(p) { pinMode(p, INPUT_PULLUP); }
// Returns true once per physical press.
bool pressed() {
bool now = digitalRead(pin);
if (now != last) { last = now; changedAt = millis(); }
if (millis() - changedAt > 25 && now != stable) {
stable = now;
return stable == LOW; // active-low with INPUT_PULLUP
}
return false;
}
};@roshan_flies
@mentor_anish