New Wink - Base Sketch Error

Wink setup, hardware, basic programming. User to user support.
ddobrien
Posts: 5
Joined: Mon Dec 26, 2016 11:08 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

New Wink - Base Sketch Error

Postby ddobrien » Mon Dec 26, 2016 11:29 pm

Hi. We just got two Winks for Christmas. We've downloaded all the drivers, library, Base Sketch, etc.

When we went into to Base Sketch to try our first lesson (changing the eyes), we tested the verify button and get errors before even adding or changing code. I've tried deleted the Base Sketch folder, redownloading/unzipping it. But I still get the error below. Any help would be very appreciated.

In file included from /Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/Wink_BaseSketch_Rev01_03.ino:21:0:
sketch/WinkHardware.h:249:20: warning: 'irData' initialized and declared 'extern'
extern byte irData[]={0x00,0xFF,0x00,0x00};
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino: In function 'simpleLightLevelRight()':
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:176:19: warning: iteration 5 invokes undefined behavior [-Waggressive-loop-optimizations]
if(eyesColor[x]>0){
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:175:3: note: containing loop
for(x=1;x<=6;x++){
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino: In function 'simpleLightLevelLeft()':
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:198:19: warning: iteration 5 invokes undefined behavior [-Waggressive-loop-optimizations]
if(eyesColor[x]>0){
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:197:3: note: containing loop
for(x=1;x<=6;x++){
^

ddobrien
Posts: 5
Joined: Mon Dec 26, 2016 11:08 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby ddobrien » Wed Dec 28, 2016 1:14 am

I should probably include the code. Note that the error I posted above came before I added the "eyes" loop info. I tried that just a while ago to see if that mattered/helped.

Below is the code (I didn't change anything above the Loop function - I was getting the errors posted above with that section blank). Thanks again. Any help would be appreciated.

/*

Wink Robot
Wink_BaseSketch_Rev01_03
Version 1.3 01/2016

This is a basic sketch that can be used as a starting point
for various functionality of the Wink robot.

This code was written by Kevin King and
Dustin Soodak for Plum Geek LLC.
Portions from other open source projects where noted.
This code is licensed under:
Creative Commons Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)
https://creativecommons.org/licenses/by-sa/2.0/
Visit http://www.plumgeek.com for Wink information.
Visit http://www.arduino.cc to learn about the Arduino.

*/

#include "WinkHardware.h" // Leave this line first. Do not edit this line. This causes Arduino
// to include background functions when turning your code into
// machine language Wink can understand.


// Below is the "setup" function. It runs one time as soon as Wink turns on. You can add stuff
// to this function if you want, but hardwareBegin() should always be the first code in the list.

void setup(){
hardwareBegin(); //initialize Wink's brain to work with his circuitry
playStartChirp(); //Play startup chirp and blink eyes

}


// Below is the "loop" function. This is where you'll write most of your code. Whatever is included
// inside the "loop" function will run over and over until Wink runs out of power or you turn him off.

void loop(){
eyesPurple(100); //both eyes purple at 100 brightness
delay(3000); //wait 3 seconds
rightOff(); //turn off right eye (so he "winks")
delay(250); //wait 1/4 second
}

User avatar
sil
Posts: 40
Joined: Thu Oct 01, 2015 1:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby sil » Thu Dec 29, 2016 12:00 am

I dont see anything obvious with your code and the errors don't point to that. I'm at work away from my Wink so can't test my idea but I think its a problem in the "WinkHardware.ino" file. If you feel confident you can try replacing it. Go to some code I posted here on the forum:, scroll to my final post and download the zip of my code I uploaded and replace both WinkHardware.h and WinkHardware.ino files in your project folder as both are very different in the current online version and I think the ones in my zip were the previous version. They show the same revision number as whats currently on the site in their headers but are about 2KB in difference so I think the last uploaded base sketch to the site had unfound bugs in it. So unless you have your own earlier version includes to try you can grab them out of my posted project and copy the two WinkHardware.* files to your own folder replacing the ones there.

Hope this makes sense.

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby Kevin » Thu Dec 29, 2016 3:39 am

Hello ddobrien,

Sorry for the delay getting back to you. We got overwhelmed going into Christmas.

It looks like it can't see the WinkHardware.ino file.

Inside the Arduino IDE, do you see a set of tabs across the top? One should be named WinkHardware, and WinkHardware.h, and a couple more. If not, then that is the problem. The IDE uses code in these other tabs when compiling. Normally we'd just link to a library for these functions (and prob will in the future) but we wanted to leave them open and easy to edit by users as the product is still fairly new and people are doing interesting things with it.

To get the tabs open, open the sketch from within the Arduino IDE from the File menu. Sometimes double clicking the sketch in Windows Explorer won't trigger Arduino to open the tabs and cause this problem.

I would suggest downloading a fresh new copy of the Base Sketch from our website. Unzip that folder and open it, then try to compile it by clicking the "check mark" button in the upper left corner of the Arduino IDE. If it compiles without errors then you should be good. If you're still getting errors, then we need to do some more investigating. I haven't heard of this happening before if the tabs are open so it should be an easy fix.

Hope that gets you up and running and you can get back to having some fun. :)

Cheers!
-Kevin

ddobrien
Posts: 5
Joined: Mon Dec 26, 2016 11:08 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby ddobrien » Thu Dec 29, 2016 6:15 am

Thanks Sil and Kevin for jumping in to help. I've tried replacing both the WinkHardware.h and WinkHardware.ino files (with the files provided by Sil). When that didn't work, I removed everything from my mac (the driver, Arduino, all the software in the libraries, and both the pre-programmed behaviors and the base sketch. I downloaded it all over again following the guides, step-by-step, on PlumGeek.com. I then compiled (no changes made to the base sketch code) and got the errors below (also pasted the code above the errors). Thanks again for taking another look.

/*

Wink Robot
Wink_BaseSketch_Rev01_03
Version 1.3 01/2016

This is a basic sketch that can be used as a starting point
for various functionality of the Wink robot.

This code was written by Kevin King and
Dustin Soodak for Plum Geek LLC.
Portions from other open source projects where noted.
This code is licensed under:
Creative Commons Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)
https://creativecommons.org/licenses/by-sa/2.0/
Visit http://www.plumgeek.com for Wink information.
Visit http://www.arduino.cc to learn about the Arduino.

*/

#include "WinkHardware.h" // Leave this line first. Do not edit this line. This causes Arduino
// to include background functions when turning your code into
// machine language Wink can understand.


// Below is the "setup" function. It runs one time as soon as Wink turns on. You can add stuff
// to this function if you want, but hardwareBegin() should always be the first code in the list.

void setup(){
hardwareBegin(); //initialize Wink's brain to work with his circuitry
playStartChirp(); //Play startup chirp and blink eyes

}


// Below is the "loop" function. This is where you'll write most of your code. Whatever is included
// inside the "loop" function will run over and over until Wink runs out of power or you turn him off.

void loop(){

// you can begin writing your own code here





} //closing curly of the “loop()” function


In file included from /Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/Wink_BaseSketch_Rev01_03.ino:21:0:
sketch/WinkHardware.h:249:20: warning: 'irData' initialized and declared 'extern'
extern byte irData[]={0x00,0xFF,0x00,0x00};
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino: In function 'simpleLightLevelRight()':
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:176:19: warning: iteration 5 invokes undefined behavior [-Waggressive-loop-optimizations]
if(eyesColor[x]>0){
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:175:3: note: containing loop
for(x=1;x<=6;x++){
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino: In function 'simpleLightLevelLeft()':
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:198:19: warning: iteration 5 invokes undefined behavior [-Waggressive-loop-optimizations]
if(eyesColor[x]>0){
^
/Users/deborahobrien/Documents/Arduino/Software from PG/Wink_BaseSketch_Rev01_03/WinkHardware.ino:197:3: note: containing loop
for(x=1;x<=6;x++){
^

User avatar
sil
Posts: 40
Joined: Thu Oct 01, 2015 1:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby sil » Fri Dec 30, 2016 5:45 am

Can you reread an answer Kevins post please, particularly about the tabs. Its likely you missed a step with installing the needed extra files into the arduino software. The arduino software, the files package for the robots and a third package of files for some of the hardware installed onto the robots are from three seperate suppliers. Many people have trouble it seems with getting the files packages into the correct locations so the arduino software can see and use them.

User avatar
sil
Posts: 40
Joined: Thu Oct 01, 2015 1:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby sil » Fri Dec 30, 2016 5:57 am

Go to the getting started page

Then scroll down to the section headed Install Ringo Software Libraries and make sure you followed those precisely in the way and order specified there. A lot of people get these wrong so get errors trying first code so dont despair.

ddobrien
Posts: 5
Joined: Mon Dec 26, 2016 11:08 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby ddobrien » Fri Dec 30, 2016 4:15 pm

Thanks again. I believe I have all the right tabs and have followed Kevin's suggestion above. I've actually re-downloaded and followed the Getting Started steps 3 times. The last two quite Meticulously. If I missed something, it'd be a step or an action that's not detailed in the video or the guide. I also went in and tried replacing some of the individual files within the Library with those you provided. So I feel like (but could be wrong), I have all the right files installed in the right places. I'm away from home right now, but I could also show screen shots of the files/tabs, if that would be helpful. It's certainly possible I'm not seeing something that more experienced individuals might. Thanks again.

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby Kevin » Sat Dec 31, 2016 2:58 am

Hello ddobrien,

What version Arduino IDE are you running? Sometimes Arduino updates the IDE and things unexpectedly break. That's never really happened with the code for our units but I'd be curious to rule that out.

I'll follow up in email and maybe we can exchange some screen shots.

Strange issue. I'll look forward to getting to the bottom of it.

-Kevin

chenhao
Posts: 1
Joined: Thu Jul 20, 2017 2:01 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: New Wink - Base Sketch Error

Postby chenhao » Thu Jul 20, 2017 2:09 pm

Hi

I got exactly the same errors that ddobrien have. I receive the new Wink last weekend and tried two days, but the Base Sketch keep giving those errors.

/home/acp12cw/Arduino/Wink_BaseSketch_Rev01_03/WinkHardware.ino: In function 'simpleLightLevelLeft()':
/home/acp12cw/Arduino/Wink_BaseSketch_Rev01_03/WinkHardware.ino:198:19: warning: iteration 5 invokes undefined behavior [-Waggressive-loop-optimizations]
if(eyesColor[x]>0){
^
/home/acp12cw/Arduino/Wink_BaseSketch_Rev01_03/WinkHardware.ino:197:3: note: containing loop
for(x=1;x<=6;x++){
^
I have try three computers Msc and Linux system, followed all the steps and the steps in above post, copied WinkHardware.ino and WinkHardware.h from you other zip file etc, but the error always there. Could you please check the Wink_Base_Sketch_Rev01_03 on the website and see if it got some problem? Or if ddobrien found a way to solve it?

Thanks in advance,
Chenhao


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 6 guests