Due to increasing spam attacks, forum registrations are currently paused to keep our community safe and spam-free. Come hang out and stay connected with us on the SimHub Discord: https://discord.com/invite/nBBMuX7!
Catch you on Discord — and thanks for understanding!
Catch you on Discord — and thanks for understanding!
Notifications
Clear all
Projects
1
Posts
1
Users
0
Reactions
1,068
Views
Topic starter
14/10/2024 8:57 am
Hello, I want to make a simple circuit using Eurotruck simulation 2 and a gauge using LEDs to make RPM alarms. I made it based on less coding together, but unfortunately it didn't work. Can anyone tell me the problem?
The link below is a picture of my circuit diagram.
removed link
#ifndef SHCUSTOMPROTOCOL_H
#define SHCUSTOMPROTOCOL_H
#include <Arduino.h>
class SHCustomProtocol {
private:
public:
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
}
void read()
{
int rpm = FlowSerialReadStringUntil('\n').toInt();
if (rpm > 80) {
digitalWrite(4, HIGH);
}
else {
digitalWrite(4, LOW);
}
if (rpm > 85) {
digitalWrite(3, HIGH);
}
else {
digitalWrite(3, LOW);
}
if (rpm > 90) {
digitalWrite(2, HIGH);
}
else {
digitalWrite(2, LOW);
}
}
void loop() {
}
void idle() {
}
};
#endif