Skocz do zawartości

Problem z biblioteką SK6812


Makee

Pomocna odpowiedź

Witam,

Ściągnąłem z https://github.com/Electry/Arduino_SK6812/tree/93c0fca17c12e8d782521cb69fd295e0280e7193#arduino_sk6812 bibliotekę, zainstalowałem w Arduino IDE na WIN 10, na sprawdzenie wkleiłem przykład ze strony, werfikacja  a tuuu, byk wywaliło. Powtórzyłem na innym lapku z Win 7 i zadziałało w pracy Win 10 też zadziałało.

O co kaman? Byk poniżej. 

In file included from J:\led\sketch_oct24a\sketch_oct24a.ino:1:0:
c:\Users\LENOVO\Documents\Arduino\libraries\SK6812/SK6812.h:1:1: error: expected unqualified-id before '{' token
 {"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"README.md","path":"README.md","contentType":"file"},{"name":"SK6812.cpp","path":"SK6812.cpp","contentType":"file"},{"name":"SK6812.h","path":"SK6812.h","contentType":"file"},{"name":"SK6812_io.cpp","path":"SK6812_io.cpp","contentType":"file"}],"totalCount":4}},"fileTreeProcessingTime":2.396226,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":138751921,"defaultBranch":"master","name":"Arduino_SK6812","ownerLogin":"Electry","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2018-06-26T14:43:22.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/12598379?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1530024346.0","canEdit":false,"refType":"branch","currentOid":"93c0fca17c12e8d782521cb69fd295e0280e7193"},"path":"SK6812.h","currentUser":null,"blob":{"rawLines":["#ifndef SK6812_H_","#define SK6812_H_","","#include <util/delay.h>","#include <stdint.h>","#include <Arduino.h>","","#ifndef F_CPU","#define  F_CPU 16000000UL","#endif","","struct RGBW {","\tuint8_t g; // 0","\tuint8_t r; // 1","\tuint8_t b; // 2","\tuint8_t w; // 3","};","","class SK6812 {","public: ","\tSK6812(uint16_t num_led);","\t~SK6812();","\t","\tvoid set_output(uint8_t pin);","\t","\tRGBW get_rgbw(uint16_t index);","\tuint8_t set_rgbw(uint16_t index, RGBW px_value);","","\tvoid sync();","\t","private:","\tuint16_t _count_led;","\tRGBW *_pixels;","","\tconst volatile uint8_t *_port;","\tvolatile uint8_t *_port_reg;","\tuint8_t _pin_mask;","","\tvoid sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask, uint8_t *port, uint8_t *portreg);","","};","","#endif /* SK6812_H_ */"],"stylingDirectives":[[{"start":1,"end":7,"cssClass":"pl-k"}],[{"start":1,"end":7,"cssClass":"pl-k"},{"start":8,"end":17,"cssClass":"pl-en"}],[],[{"start":1,"end":8,"cssClass":"pl-k"},{"start":9,"end":23,"cssClass":"pl-s"},{"start":9,"end":10,"cssClass":"pl-pds"},{"start":22,"end":23,"cssClass":"pl-pds"}],[{"start":1,"end":8,"cssClass":"pl-k"},{"start":9,"end":19,"cssClass":"pl-s"},{"start":9,"end":10,"cssClass":"pl-pds"},{"start":18,"end":19,"cssClass":"pl-pds"}],[{"start":1,"end":8,"cssClass":"pl-k"},{"start":9,"end":20,"cssClass":"pl-s"},{"start":9,"end":10,"cssClass":"pl-pds"},{"start":19,"end":20,"cssClass":"pl-pds"}],[],[{"start":1,"end":7,"cssClass":"pl-k"}],[{"start":1,"end":7,"cssClass":"pl-k"},{"start":9,"end":14,"cssClass":"pl-en"},{"start":15,"end":25,"cssClass":"pl-c1"}],[{"start":1,"end":6,"cssClass":"pl-k"}],[],[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":11,"cssClass":"pl-en"}],[{"start":1,"end":8,"cssClass":"pl-c1"},{"start":12,"end":16,"cssClass":"pl-c"},{"start":12,"end":14,"cssClass":"pl-c"}],[{"start":1,"end":8,"cssClass":"pl-c1"},{"start":12,"end":16,"cssClass":"pl-c"},{"start":12,"end":14,"cssClass":"pl-c"}],[{"start":1,"end":8,"cssClass":"pl-c1"},{"start":12,"end":16,"cssClass":"pl-c"},{"start":12,"end":14,"cssClass":"pl-c"}],[{"start":1,"end":8,"cssClass":"pl-c1"},{"start":12,"end":16,"cssClass":"pl-c"},{"start":12,"end":14,"cssClass":"pl-c"}],[],[],[{"start":0,"end":5,"cssClass":"pl-k"},{"start":6,"end":12,"cssClass":"pl-en"}],[{"start":0,"end":7,"cssClass":"pl-k"}],[{"start":1,"end":7,"cssClass":"pl-en"},{"start":8,"end":16,"cssClass":"pl-c1"}],[{"start":1,"end":8,"cssClass":"pl-en"}],[],[{"start":1,"end":5,"cssClass":"pl-k"},{"start":6,"end":16,"cssClass":"pl-en"},{"start":17,"end":24,"cssClass":"pl-c1"}],[],[{"start":6,"end":14,"cssClass":"pl-en"},{"start":15,"end":23,"cssClass":"pl-c1"}],[{"start":1,"end":8,"cssClass":"pl-c1"},{"start":9,"end":17,"cssClass":"pl-en"},{"start":18,"end":26,"cssClass":"pl-c1"}],[],[{"start":1,"end":5,"cssClass":"pl-k"},{"start":6,"end":10,"cssClass":"pl-en"}],[],[{"start":0,"end":8,"cssClass":"pl-k"}],[{"start":1,"end":9,"cssClass":"pl-c1"}],[],[],[{"start":1,"end":6,"cssClass":"pl-k"},{"start":7,"end":15,"cssClass":"pl-k"},{"start":16,"end":23,"cssClass":"pl-c1"}],[{"start":1,"end":9,"cssClass":"pl-k"},{"start":10,"end":17,"cssClass":"pl-c1"}],[{"start":1,"end":8,"cssClass":"pl-c1"}],[],[{"start":1,"end":5,"cssClass":"pl-k"},{"start":6,"end":20,"cssClass":"pl-en"},{"start":21,"end":28,"cssClass":"pl-c1"},{"start":37,"end":45,"cssClass":"pl-c1"},{"start":54,"end":61,"cssClass":"pl-c1"},{"start":71,"end":78,"cssClass":"pl-c1"},{"start":86,"end":93,"cssClass":"pl-c1"}],[],[],[],[{"start":1,"end":6,"cssClass":"pl-k"},{"start":7,"end":22,"cssClass":"pl-c"},{"start":7,"end":9,"cssClass":"pl-c"},{"start":20,"end":22,"cssClass":"pl-c"}]],"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/Electry/Arduino_SK6812/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null,"repoAlertsPath":"/Electry/Arduino_SK6812/security/dependabot","repoSecurityAndAnalysisPath":"/Electry/Arduino_SK6812/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"displayName":"SK6812.h","displayUrl":"https://github.com/Electry/Arduino_SK6812/blob/master/SK6812.h?raw=true","headerInfo":{"blobSize":"698 Bytes","deleteInfo":{"deleteTooltip":"You must be signed in to make or propose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPath":"https://desktop.github.com","gitLfsPath":null,"onBranch":true,"shortPath":"cea9d66","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FElectry%2FArduino_SK6812%2Fblob%2Fmaster%2FSK6812.h","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"43","truncatedSloc":"31"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"C++","languageID":43,"large":false,"loggedIn":false,"newDiscussionPath":"/Electry/Arduino_SK6812/discussions/new","newIssuePath":"/Electry/Arduino_SK6812/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/Electry/Arduino_SK6812/blob/master/SK6812.h","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/Electry/Arduino_SK6812/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"rawBlobUrl":"https://github.com/Electry/Arduino_SK6812/raw/master/SK6812.h","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"repoOwner":"Electry","repoName":"Arduino_SK6812","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":false,"actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timedOut":false,"notAnalyzed":false,"symbols":[{"name":"RGBW","kind":"class","identStart":158,"identEnd":162,"extentStart":151,"extentEnd":234,"fullyQualifiedName":"RGBW","identUtf16":{"start":{"lineNumber":11,"utf16Col":7},"end":{"lineNumber":11,"utf16Col":11}},"extentUtf16":{"start":{"lineNumber":11,"utf16Col":0},"end":{"lineNumber":16,"utf16Col":1}}},{"name":"SK6812","kind":"class","identStart":243,"identEnd":249,"extentStart":237,"extentEnd":672,"fullyQualifiedName":"SK6812","identUtf16":{"start":{"lineNumber":18,"utf16Col":6},"end":{"lineNumber":18,"utf16Col":12}},"extentUtf16":{"start":{"lineNumber":18,"utf16Col":0},"end":{"lineNumber":40,"utf16Col":1}}},{"name":"set_output","kind":"method","identStart":308,"identEnd":318,"extentStart":303,"extentEnd":332,"fullyQualifiedName":"SK6812::set_output","identUtf16":{"start":{"lineNumber":23,"utf16Col":6},"end":{"lineNumber":23,"utf16Col":16}},"extentUtf16":{"start":{"lineNumber":23,"utf16Col":1},"end":{"lineNumber":23,"utf16Col":30}}},{"name":"get_rgbw","kind":"method","identStart":341,"identEnd":349,"extentStart":336,"extentEnd":366,"fullyQualifiedName":"SK6812::get_rgbw","identUtf16":{"start":{"lineNumber":25,"utf16Col":6},"end":{"lineNumber":25,"utf16Col":14}},"extentUtf16":{"start":{"lineNumber":25,"utf16Col":1},"end":{"lineNumber":25,"utf16Col":31}}},{"name":"set_rgbw","kind":"method","identStart":376,"identEnd":384,"extentStart":368,"extentEnd":416,"fullyQualifiedName":"SK6812::set_rgbw","identUtf16":{"start":{"lineNumber":26,"utf16Col":9},"end":{"lineNumber":26,"utf16Col":17}},"extentUtf16":{"start":{"lineNumber":26,"utf16Col":1},"end":{"lineNumber":26,"utf16Col":49}}},{"name":"sync","kind":"method","identStart":424,"identEnd":428,"extentStart":419,"extentEnd":431,"fullyQualifiedName":"SK6812::sync","identUtf16":{"start":{"lineNumber":28,"utf16Col":6},"end":{"lineNumber":28,"utf16Col":10}},"extentUtf16":{"start":{"lineNumber":28,"utf16Col":1},"end":{"lineNumber":28,"utf16Col":13}}},{"name":"sendarray_mask","kind":"method","identStart":571,"identEnd":585,"extentStart":566,"extentEnd":669,"fullyQualifiedName":"SK6812::sendarray_mask","identUtf16":{"start":{"lineNumber":38,"utf16Col":6},"end":{"lineNumber":38,"utf16Col":20}},"extentUtf16":{"start":{"lineNumber":38,"utf16Col":1},"end":{"lineNumber":38,"utf16Col":104}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/Electry/Arduino_SK6812/branches":{"post":"2mDyl-OVjwnLfbcx-w0borfocfU0utLYBZ1MZGQPza5wCmrOx5PjZ9DqOhU5H7aNlW2oRNGVLOlryblGv7Lvhg"},"/repos/preferences":{"post":"GLy72nkAQhhJx36nqdJYQFbLQ2tiRACGQVPEm63W4mAGAnGhFolmW4FPRYm98jF3oKbhfVsrd0Sh_YFHlOdH7g"}}},"title":"Arduino_SK6812/SK6812.h at master · Electry/Arduino_SK6812"}
 ^
J:\led\sketch_oct24a\sketch_oct24a.ino:5:1: error: 'SK6812' does not name a type
 SK6812 LED(2);
 ^~~~~~
J:\led\sketch_oct24a\sketch_oct24a.ino:7:1: error: 'RGBW' does not name a type
 RGBW color1 = { 0, 0, 255, 50 };  // 255 blue, 50 white
 ^~~~
J:\led\sketch_oct24a\sketch_oct24a.ino: In function 'void setup()':
J:\led\sketch_oct24a\sketch_oct24a.ino:10:3: error: 'LED' was not declared in this scope
   LED.set_output(4);  // Digital Pin 4
   ^~~
J:\led\sketch_oct24a\sketch_oct24a.ino:12:19: error: 'color1' was not declared in this scope
   LED.set_rgbw(0, color1);  // Set first LED to color1
                   ^~~~~~
J:\led\sketch_oct24a\sketch_oct24a.ino: In function 'void loop()':
J:\led\sketch_oct24a\sketch_oct24a.ino:17:3: error: 'LED' was not declared in this scope
   LED.set_rgbw(1, { 0, 0, 0, 255 });  // Set second LED to white (using only W channel)
   ^~~

exit status 1

Compilation error: 'SK6812' does not name a type

 

i kod:

#include <SK6812.h>



SK6812 LED(2);

RGBW color1 = { 0, 0, 255, 50 };  // 255 blue, 50 white

void setup() {
  LED.set_output(4);  // Digital Pin 4

  LED.set_rgbw(0, color1);  // Set first LED to color1
}

void loop() {

  LED.set_rgbw(1, { 0, 0, 0, 255 });  // Set second LED to white (using only W channel)
  LED.sync();                         // Send the values to the LEDs
  delay(500);

  LED.set_rgbw(1, { 255, 255, 255, 0 });  // Set second LED to white (using only RGB channels)
  LED.sync();
  delay(500);
}

 

Edytowano przez Makee
  • Lubię! 1
Link do komentarza
Share on other sites

A próbowałeś przeinstalować bibliotekę?
Jak ją instalowałeś?

@Belferek ta biblioteka nie dołącza przykładów, albo ślepy jestem. 😉
Jednakże przykład wklejony z GitHuba (który kolega wyżej zarzucił) u mnie kompiluje się bez problemu. 🤔

Link do komentarza
Share on other sites

Zarejestruj się lub zaloguj, aby ukryć tę reklamę.
Zarejestruj się lub zaloguj, aby ukryć tę reklamę.

jlcpcb.jpg

jlcpcb.jpg

Produkcja i montaż PCB - wybierz sprawdzone PCBWay!
   • Darmowe płytki dla studentów i projektów non-profit
   • Tylko 5$ za 10 prototypów PCB w 24 godziny
   • Usługa projektowania PCB na zlecenie
   • Montaż PCB od 30$ + bezpłatna dostawa i szablony
   • Darmowe narzędzie do podglądu plików Gerber
Zobacz również » Film z fabryki PCBWay

Bądź aktywny - zaloguj się lub utwórz konto!

Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony

Utwórz konto w ~20 sekund!

Zarejestruj nowe konto, to proste!

Zarejestruj się »

Zaloguj się

Posiadasz własne konto? Użyj go!

Zaloguj się »
×
×
  • Utwórz nowe...

Ważne informacje

Ta strona używa ciasteczek (cookies), dzięki którym może działać lepiej. Więcej na ten temat znajdziesz w Polityce Prywatności.