Answer the question
In order to leave comments, you need to log in
What's wrong with calling void functions in PlatformIO?
I use PlatformIO to work with Arduino. When I use functions of type void in a sketch, the compiler throws an error: 'screen_function' was not declared in this scope [20, 20]
here is the sketch itself:
#include <Arduino.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
#define button 2
#define screenPower 9 //пин, отвечающий за питание дисплея
boolean powerFlag = 0; //флаг переключения питания
LiquidCrystal_PCF8574 lcd(0x27);
void setup(){
pinMode(screenPower, OUTPUT);
pinMode(button, INPUT_PULLUP);
}
void loop(){
screen_function(); //здесь выдаёт ошибку
}
void screen_function(){ //вкл-выкл дисплея с помощью управления пином
if (digitalRead(button) == LOW){ //использую подтяжку к земле, сигнал инвертируется
powerFlag = !powerFlag;
digitalWrite(screenPower, powerFlag);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question