How to program wink

Wink setup, hardware, basic programming. User to user support.
[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
JCH
Posts: 3
Joined: Sun Apr 17, 2016 11:12 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

How to program wink

Postby JCH » Sun Apr 17, 2016 11:23 am

Hi when I follow the lessons and the code I keep getting errors. However when I use the companion code it is fine and there are lots of additional tabs and code. The wink robot moves like it should be.

I tried writing it out like I lesson 1. In lesson 1 companion code there is attached library and additional tabs and code.

void setup() {
HardwareBegin();
}

void loop() {
// put your main code here, to run repeatedly:
EyesPurple();
delay(3000);
RightOff();
delay(250);

}


I'm still new to Arduino and have played around a little bit with the Arduino Uno but I struggle with the wink due to me not finding much information probably me being blind. There wasn't any instructions when it was delivered either only on the website so I struggled for a little bit.

Help would be very much appreciated.

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: How to program wink

Postby sil » Sun Apr 17, 2016 10:38 pm

When you get errors they tell you what went wrong so its hard to help unless you post them.

My guess is you created a new completely blank sketch, from memory plumgeek provide a "blank" example you should use as a starting point which has the #include line you are missing (which is why you don't have extra tabs and why your example won't run. Arduino is a platform and doesn't know anything about Ringo or Wink, which is why plumgeek provide extra files in the setup instructions that tell the Arduino development software how to talk to your plumgeek robots but YOU have to tell it what to use so you should have a line something like:

#include "WinkHardware.h"

towards the top of the code before any void blocks.


Recheck the menu where your Wink examples appear for something with "blank" in the name. When you start a lesson or write your own code, start by loading this blank example and immediately "Save As" to whatever new name you want so you always have that blank example clean and ready to start from in the future. This blank example should call the include file and probably have an empty loop() block ready for you to type code into.

wclift
Posts: 32
Joined: Sun Feb 07, 2016 6:10 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: How to program wink

Postby wclift » Mon Apr 18, 2016 5:31 am

Hello JCH,
When I first started playing with Wink, I was also completely new to Arduino. I followed all the tool installation instructions to use the ArduinoIDE on my desktop, and I downloaded all the drivers, and I copied all the templates and finally got the hang of it. Then, when trying to enable arduino Wink coding on a chromebook, I discovered Codebender.cc. It's a web-based arduinoIDE that requires no software downloads, and all sketches from others are available and searchable. So, I uploaded the Wink base sketch here:



Now, I can copy or "clone" the base sketch as a starting point for any new sketch. You can copy my base sketch and use it. I don't know if it will be easier for you to figure out the basesketch template from your current IDE or if switching to Codebender would be easier. But Sil is right that you are probably trying to program using the IDE's starting sketch instead of first opening the Wink Base Sketch as a starting point.

I have another thread on this forum describing my Codebender discoveries, so you can read more there.

Good Luck,
Wayne

JCH
Posts: 3
Joined: Sun Apr 17, 2016 11:12 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: How to program wink

Postby JCH » Mon May 02, 2016 1:00 pm

Ok I understand I thought it was programming from scratch and adding the wink library's we downloaded. Also on the plum geek site where is the pure base code?

So with each lesson we are adjusting the companion code using the lesson guides?

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: How to program wink

Postby sil » Thu Jun 23, 2016 2:11 am

Have a look on for the section marked Wink Demo Software it has a table which has the base sketch that should be what you need as the starting point. this is the "starting from scratch" point you should be starting from. Remember lines starting with "//" are human readable comments ignored by the Wink blocks of human readable comments start with "/* and they are ignored until a "*/" closes them off. So loading the base sketch you will see whats already in it is 90% comments that are ignored and could be deleted, leaving an #include statement that loads in the custom commands for Wink , this ALWAYS need to be there and is NOT a comment, then there is the setup() area to prepare the Wink hardware to do something (think turning a key in a car) and finally the loop() area which is empty and where you write your code for Wink to follow and do stuff.

I suggest you get used to recognising comments fast, dont be daunted, like reading a book code gets run starting at the top and working down but you can be taken out to a different point but then return again (like footnote notation in a book). Comments are ignored when the code gets compiled to send to the Wink and I assume deleted in that process but not from your file, just from what gets sent to Wink which would be in a machine readable language. Comments are handy to plot out what you want in your code and label what areas of code are meant to do, you can quickly comment out pieces of code to help debug or refine your code. Especially to share your code back on the forum for others, you should have well commented code so others can understand what a bit of code is doing and also for yourself when you revisit code you'd worked on months ago.

Once you get a first bit of code working you'll get the hang of it. Don't stress about it, there are often many ways to achieve the same result in programming that can all work, generally there's no right or wrong way to do something and its interesting to see the way different people approach the same task from different directions. Its ok to feel excited to see Wink perform even the "simplest" task when you get your first code running. I'm still a beginner myself, over the years I've tried to learn to program many times and always gave up, I keep coming back to Ringo and Wink though just to tinker with new ideas. Enjoy!


[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
[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 4 guests