Translating the Arduino Sketches into a SPIN function
Buck Rogers
Posts: 2,185
Hello!
The camera boards I bought from Micro Center a while ago, the Mini Spy Camera have a learning example set in those sketches for their simpler versions of the Arduino. For example:
They believe that would run on one of their full featured ones. I want to do one better and see what's involved in translating it into SPIN. And as for how, I'm thinking it can't be too difficult as the code for the NeoPixels was successfully translated into SPIN, and it runs faster and better on the different Prop ones I've tried it out on versus the Arduino design I first did try theirs on. (Incidentally this is the thing in the Altoids tin.)
The camera boards I bought from Micro Center a while ago, the Mini Spy Camera have a learning example set in those sketches for their simpler versions of the Arduino. For example:
int trig = 0; int led = 1; void setup() { // initialize the digital pins as output. pinMode(led, OUTPUT); pinMode(trig, OUTPUT); digitalWrite(led, HIGH); digitalWrite(trig, HIGH); } // Hold HIGH and trigger quick (<250ms) LOW to take a photo. Holding LOW and trigger HIGH starts/stops video recording void loop() { digitalWrite(trig, LOW); digitalWrite(led, HIGH); delay(50); digitalWrite(trig, HIGH); digitalWrite(led, LOW); delay(5000); }
They believe that would run on one of their full featured ones. I want to do one better and see what's involved in translating it into SPIN. And as for how, I'm thinking it can't be too difficult as the code for the NeoPixels was successfully translated into SPIN, and it runs faster and better on the different Prop ones I've tried it out on versus the Arduino design I first did try theirs on. (Incidentally this is the thing in the Altoids tin.)
Comments
fun.
On larger programs you need to decide how to handle
C/C++ pointers, structs, classes, enumerations, files
(.ino, .cpp, .h) etc.
Bill M.
Cheers,
Jesse
Hello!
Dave? That's the code above that I'm interesting in converting. Here I'll snag it and post it again: And that's the code I need help in translating. In fact that's one of two, code blocks, published for the purpose. The other in a different Adafruit Learn paging describes a related function and also similar methods for wiring the camera board.
You are not. What they use is a language called Processing. It's big problem is that as the program gets bigger it starts to look like a bad case of noodles all over the place.
That's the same problem in all languages, if a beginner writes all the commands in a row, without giving it a structure with loops and subroutines.
'Processing' and 'Wiring', which Arduino uses, is just C/C++, with a special library, and some simplified rules.
The functions used in your example are really the most basic ones, that every beginner learns to blink a LED.
Translated to Spin it can look like that: