Go Down

Topic: Het maken van een Bibliotheek (Read 254 times) previous topic - next topic

JeroenSAR

Beste Forumleden,

ik heb een best groot stukje tekst wat ik alleen maar gebruik om mijn volume naar beneden te krijgen.
nu dacht ik, ik maak er een libary van. geen gekke gedachte alleen krijg steeds een foutmelding;

Code: [Select]
"Arduino: 1.8.5 (Windows 10), Board:"Arduino/Genuino Uno"

VolumeDown.h:13: error: expected unqualified-id before ')' token

     void VolumeDown();

                     ^

VolumeDown.h:17: error: abstract declarator '<anonymous class>' used as declaration

 };

 ^

exit status 1
expected unqualified-id before ')' token


dit is mijn VolumeDown.h File:
Code: [Select]
#ifndef VolumeDown
#define VolumeDown

#if (ARDUINO >=100)
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

class VolumeDown
{
    public:
    void VolumeDown();
    private:
   
   
};
#endif


 en dit is mijn VolumeDown.cpp;
Code: [Select]
#include "Arduino.h"
#include "VolumeDown.h"
void VolumeDown::VolumeDown(){
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x1F);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x1E);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x1D);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x1C);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x1B);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x1A);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x19);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x18);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x17);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x16);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x15);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x14);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x13);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x12);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x11);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x10);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0xF);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0xE);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0xD);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0xC);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0xB);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0xA);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x9);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x8);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x7);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x6);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x5);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x4);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x3);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x2);
Serial.write(0x7E);
delay(300);
Serial.write(0x7E);
Serial.write(0x03);
Serial.write(0xA7);
Serial.write(0x1);
Serial.write(0x7E);
delay(300);
}


ik heb er al een nachtje over geslapen maar kom er nog steeds niet uit. kan een van jullie mij helpen met deze opgave

bedankt voor het meekijken.

mvg Jeroen

nicoverduin

#1
May 19, 2018, 08:53 pm Last Edit: May 19, 2018, 08:54 pm by nicoverduin
VolumeDown is de class name. De method VolumeDown wordt dan gezien als de constructor. En die heeft geen return code. Dus zonder de void. Void dus weg laten
Met vriendelijke groet / kindest regards
Nico Verduin
www.verelec.nl
Do not PM me for personal consultancy unless you are willing to pay for it.

septillion

Overigens is voor het vaak hetzelfde doen de loop uitgevonden ;) Ook is het vaak niet zo practisch seconden lang te wachten in delays...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Go Up