I was doing a programm to speedcube with a display and two buttons. Now what happens I have an error. 'pulsador' was not declared in this scope. Can someone help me please.
#include <pt.h>
struct pt hilo1;
struct pt hilo2;
int digit1 = 6; //PWM Display most left display
int digit2 = 9; //PWM Display second left
int digit3 = 10; //PWM Display second right display
int digit4 = 11; //PWM Display most right display
int estado;
int contador;
#define DIGIT_ON LOW
#define DIGIT_OFF HIGH
#define DISPLAY_BRIGHTNESS 600
boolean duiz = false;
boolean hon = false;
int segA = 2;
int segB = 3;
int segC = 4;
int segD = 5;
int segE = A0; //pin 6 is used bij display 1 for its pwm function
int segF = 7;
int segG = 8;
//int segPD = ;
void setup() {
PT_INIT(&hilo1);
PT_INIT(&hilo2);
contador=0;
pinMode(segA, OUTPUT);
pinMode(segB, OUTPUT);
pinMode(segC, OUTPUT);
pinMode(segD, OUTPUT);
pinMode(segE, OUTPUT);
pinMode(segF, OUTPUT);
pinMode(segG, OUTPUT);
pinMode(digit1, OUTPUT);
pinMode(digit2, OUTPUT);
pinMode(digit3, OUTPUT);
pinMode(digit4, OUTPUT);
Serial.begin(9600);
}
void loop() {
crono(&hilo1);
pulsador(&hilo2);
}
void crono(struct pt *pt){
PT_BEGIN(pt);
static long t = 0;
do {
while(true);
PT_END(pt);
if (contador==1){
for( int i = 0; i<=9999; i++){
duiz = false;
hon = false;
for(int k = 0; k<50; k++){
int figur = i;
for(int digit = 1 ; digit < 5 ; digit++){
switch(digit) {
case 1:
if(figur > 999){
digitalWrite(digit1, DIGIT_ON);
lightNumber(figur / 1000);
figur %= 1000;
delayMicroseconds(DISPLAY_BRIGHTNESS);
if (figur < 100){
duiz = true;
if (figur <10){
hon = true;
}else duiz = false;
}
break;
case 2:
if(duiz == true){
digitalWrite(digit2, DIGIT_ON);
lightNumber(0);
delayMicroseconds(DISPLAY_BRIGHTNESS);
}if(hon == true){
break;
}
if(figur > 99 && figur < 1000){
digitalWrite(digit2, DIGIT_ON);
lightNumber(figur / 100);
figur %= 100;
delayMicroseconds(DISPLAY_BRIGHTNESS);
if (figur < 10){
hon = true;
}else hon = false;
}
break;
case 3:
if(hon == true){
digitalWrite(digit3, DIGIT_ON);
lightNumber(0);
delayMicroseconds(DISPLAY_BRIGHTNESS);
break;
}
if(figur > 9 && figur < 100){
digitalWrite(digit3, DIGIT_ON);
lightNumber(figur / 10);
figur %= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS);
}
break;
case 4:
if(figur < 10){
digitalWrite(digit4, DIGIT_ON);
lightNumber(figur);
delayMicroseconds(DISPLAY_BRIGHTNESS);
break;
}
}
lightNumber(10);
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
}
}
}
}
}
}while(true);
PT_END(pt);
}
void lightNumber(int numberToDisplay) {
#define SEGMENT_ON HIGH
#define SEGMENT_OFF LOW
switch (numberToDisplay){
case 0:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_OFF);
break;
case 1:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 2:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 3:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 4:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 5:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 6:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 7:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 8:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 9:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 10:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF)o;
break;
}
}
void pulsador(struct pt *pt){
PT_BEGIN(pt);
static long t=0;
do{
estado=digitalRead(13);
if (estado==HIGH){
delay(3000);
if (estado==HIGH){
Serial.println("HIGH");
contador=1;
}
}
if (estado==LOW){
Serial.println("LOW");
}
}while(true);
PT_END(pt);
}