Fix indentation

This commit is contained in:
ReiMerc 2023-11-29 16:25:57 +01:00
parent a734728aac
commit c56c0978e6

View File

@ -58,22 +58,22 @@ void setup(void)
carrier.display.fillScreen(0x000);
//pinouts til motor
pinMode(motor_pin1, OUTPUT);
pinMode(motor_pin2, OUTPUT);
pinMode(motor_pin3, OUTPUT);
pinMode(motor_pin4, OUTPUT);
// Pinouts for motor
pinMode(motor_pin1, OUTPUT);
pinMode(motor_pin2, OUTPUT);
pinMode(motor_pin3, OUTPUT);
pinMode(motor_pin4, OUTPUT);
}
void loop(void)
{
// Rotate motor if needed
if (motor_count) {
motor_clockwise();
motor_count--;
}
// Rotate motor if needed
if (motor_count) {
motor_clockwise();
motor_count--;
}
// Receive MQTT messages
// Receive MQTT messages
int message_size = mqtt_client.parseMessage();
if (message_size) {
Serial.print("Got message with topic: ");
@ -83,30 +83,30 @@ void loop(void)
Serial.println("Dispensing...");
// Start rotating motor
motor_count = motor_count_max;
motor_count = motor_count_max;
}
}
}
void motor_clockwise()
{
for (int i = 7; i >= 0; i--) {
motor_set_output(i);
delayMicroseconds(motor_speed);
}
for (int i = 7; i >= 0; i--) {
motor_set_output(i);
delayMicroseconds(motor_speed);
}
}
void motor_anticlockwise()
{
for (int i = 0; i < 8; i++) {
motor_set_output(i);
delayMicroseconds(motor_speed);
}
for (int i = 0; i < 8; i++) {
motor_set_output(i);
delayMicroseconds(motor_speed);
}
}
void motor_set_output(int out)
{
digitalWrite(motor_pin1, bitRead(motor_lookup[out], 0));
digitalWrite(motor_pin2, bitRead(motor_lookup[out], 1));
digitalWrite(motor_pin3, bitRead(motor_lookup[out], 2));
digitalWrite(motor_pin4, bitRead(motor_lookup[out], 3));
digitalWrite(motor_pin1, bitRead(motor_lookup[out], 0));
digitalWrite(motor_pin2, bitRead(motor_lookup[out], 1));
digitalWrite(motor_pin3, bitRead(motor_lookup[out], 2));
digitalWrite(motor_pin4, bitRead(motor_lookup[out], 3));
}