We check out the fast-paced third-person Xbox One exclusive Sunset Overdrive to see just what it has in store.
Sunset Overdrive Reviewed
We take a look at Firaxis' sci-fi take on the Civ universe
Civilization: Beyond Earth Reviewed
We sit down with Blizzard's Ion Hazzikostas to talk all things World of Warcraft, including upcoming expansion Warlords of Draenor.
Talking Draenor with Ion Hazzikostas
Here it is, AusGamers looks at The Evil Within, and just what you can expect from grandaddy horror creator Shinji Mikami
The Evil Within Review
playing in an arduino's code playground
trillion
Gladstone, Queensland
3557 posts

a question for anyone that might know some pointers for this error i can't figure out

so i've got an arduino board (don't worry i'm not going to get zapped it's all shielded below 5v so i'm told) and i'm trying to get a code snippet that exposes the control variables of a number of actuating servo motors to compile in the ide, but the compiler is giving errors such as 'var_name' was not declared in this scope at runtime. since i haven't debugged C++ in aaaaaaages i was wondering if anyone here know's what's up with those errors and if it's maybe a missing library/header file reference or environment variable that hasn't been set or something even uglier?
12:10am 13/06/14 Permalink
system
Internet
--
12:10am 13/06/14 Permalink
Whoop
Brisbane, Queensland
23006 posts
Means just what it says, you haven't declared the variables anywhere.
e.g.
a missing myServoposition = 0 somewhere, and later you go
for whatever amount of time to 0 do
something else with myServoposition move some s*** from 0 to 100 (not actual code of any kind)

There's a servo example in the arduino examples if you go file -> examples -> servo, it should load a servo sketch and the associated includes (in case you forgot to #include something)

e: Also watch out if you're blindly loading examples that automatically sweep the servo. I did one and it broke the servo because it made it sweep too far, way out of the range of motion for the servo. GG.
12:33am 13/06/14 Permalink
Dazhel
Gold Coast, Queensland
6481 posts
Hard to say what the exact problem is without seeing it. Can you post the code snippet?

Also watch out if you're blindly loading examples that automatically sweep the servo. I did one and it broke the servo because it made it sweep too far, way out of the range of motion for the servo. GG.


Haha, Whoop knows the deal, I've done this too. Those little plastic geared servos have a mission in life to die a quick, cheap death I reckon.
01:00am 13/06/14 Permalink
Raven
Melbourne, Victoria
8516 posts
If you can post the sketch I'll have a proper look - but from the description you gave I'd have thought it was the opposite of what Whoop said - not that you haven't assigned it somewhere, but that you haven't defined it.

ie, mising
int someVar;

rather tahn missing
someVar = 42;

Yes, it's entirely possible you're missing a header if the value you're using was expected as a #define or const in a header.


On an unrelated note, I got 10 more Arduino boards the other day. Anyone want to earn some cash helping me with antenna design/theory? (yes, seriously).
10:15am 13/06/14 Permalink
trillion
Gladstone, Queensland
3558 posts
yeah alright i'd post the code snippet but the server here will probably jumble the syntax when it sanitises the info

i'm working from this tutorial and i'm stuck at the arduino code section because the compiler obviously isn't accepting the var typing from that snippet to write that code to the arduino's eprom

also i would have though there'd be a way to mitigate the phase sweep's effect on destroying the tiny motor but there doesn't seem to be any apparent way of doing that. and anyway it's not broken yet but i can imagine if this code ever writes to the board it might do so with the processing control input. that doesn't really bother me as it's just a testing motor

here's where it's at

http://i.imgur.com/qor5G5B.jpg

and thank you for the help team, there seem to be a lot of variables and the board is only? arduino compatible so maybe it's some kind of hardware/ide version mismatch
10:18am 13/06/14 Permalink
Raven
Melbourne, Victoria
8517 posts
Just chuck it on pastebin if you're worried about Triumph butchering it, and post the link here. Or a Dropbox link.
10:19am 13/06/14 Permalink
Whoop
Brisbane, Queensland
23007 posts
Looks like the board / servo I have.

Servos have no mechanical failsafe, if you don't write one it'll just keep on spinning.
If you can post the sketch I'll have a proper look - but from the description you gave I'd have thought it was the opposite of what Whoop said - not that you haven't assigned it somewhere, but that you haven't defined it.

ie, mising
int someVar;

rather tahn missing
someVar = 42;

Yes, it's entirely possible you're missing a header if the value you're using was expected as a #define or const in a header.


On an unrelated note, I got 10 more Arduino boards the other day. Anyone want to earn some cash helping me with antenna design/theory? (yes, seriously).

Usually the library takes care of that stuff and you just tell the board which pins it needs and any other variables.

Did you try the example in the arduino ide, trillion?
12:14pm 13/06/14 Permalink
Whoop
Brisbane, Queensland
23008 posts
Ok I tried their code and even with the library they give you, it fails to compile. It looks like the library itself is broken. It's the same name as a library that came with arduino's IDE, but a lot smaller in size.

What exactly are you trying to do? Control the servo using the serial console?
05:00pm 13/06/14 Permalink
ph33x
Thailand
2120 posts
What are you making? A drone controller?
06:00pm 13/06/14 Permalink
trillion
Gladstone, Queensland
3559 posts
thanks for confirming Whoop. yeah i'm trying to write the servo code to the arduino board so i can then use processing to interface a mouse control or another analog input like an xbox360 controller to articulate the robotic setup. i'm confident the procontroll lib for processing will do the trick there but i need to get the servo controller up and working in arduino before getting to that

ph33x it's for the glados robot project (see previous thread i suppose) i've been working on. i'd post up some more recent pictures of it but i'll just post a video of it working if i ever get it done :)
06:38pm 13/06/14 Permalink
ph33x
Thailand
2121 posts
Yeah I think I saw it, 3D printed parts? Will be interesting to see what you can do with it.

I recall seeing a glados that was a light fixture, looked awes. gl mang

06:46pm 13/06/14 Permalink
Whoop
Brisbane, Queensland
23009 posts
there's a basic sketch included as an example that uses a simple potentiometer to control the servo, you could then quite easily make your own joystick.

are you using the arduino ide? or the processing one?

attach one of these to it: http://www.jaycar.com.au/productView.asp?ID=XC4280
07:08pm 13/06/14 Permalink
trillion
Gladstone, Queensland
3561 posts
whoop afaik the arduino and processing ide's are cut from the same code or at least they look almost identical as far as gui layer in more recent iterations of the program are

anyway here are some more pics

http://2.bp.blogspot.com/-gNTBfEqwELo/T-VpUXrbU3I/AAAAAAAABk0/TrZBfNhTuw4/s1600/glados-and-chell8jpg.jpg


http://i.imgur.com/9yHgDPV.jpg


http://i.imgur.com/Nd0fvax.jpg


http://i.imgur.com/owFHKyx.jpg


http://i.imgur.com/39nsXH3.jpg


last edited by trillion at 11:05:40 14/Jun/14
11:03am 14/06/14 Permalink
Whoop
Brisbane, Queensland
23014 posts
I hope those poor little servos are strong enough to move that thing.
11:25am 14/06/14 Permalink
Whoop
Brisbane, Queensland
23015 posts
Oi trillion, I got processing to work controlling my servo via the mouse. One downside that I can't quite figure out yet is that it only works at 1fps so servo movements are kind of jerky. Not really sure what's up with that, could be because I have it connected to a digital pin (it connects to pin14 which on my mega isn't an analog pin like the sketch says it is)

Half the trouble is, all that code apparently is for a really old version of arduino, alls you gotta do is leave the standard servo library that gets installed by arduino's IDE intact, copy the code they give you and delete the servo::refresh(); line for it to compile. Elsewhere on the site it says after version like 0117 or something you don't need the refresh() call anymore.

edit: yep, tried it on my regular arduino board on analog0 and it works at 100fps. Smooth as a babies ass.

Oh and watch out, some servos draw a lot of current and will cause the board to fail. The standard little dodgy thing included with arduinos is usually fine, I tried with one that has massive amounts of torque (but still micro servo) and it kills the board, not even windows will see it anymore. Left it for a bit and it was ok so at least it wasn't permanent.

Here is the Arduino Code for a single servo on analog 0
and here is theProcessing code.
Wiring
http://i.imgur.com/tr27UV6.jpg
05:18pm 15/06/14 Permalink
trillion
Gladstone, Queensland
3567 posts
:) legend thank you

because i'm using a board that's a derivative of the arduino reference board i had to install the specific usb driver for it that fixed the serial debugger messaging issue and so now it communicates via com3

07:43pm 15/06/14 Permalink
Whoop
Brisbane, Queensland
23016 posts
I've also got the mouse working 2 servos, one off x axis and one off y axis. It's only a small change in the code if you want that too: http://pastebin.com/ER4Gu0w6
I also deleted all the extra s*** that was in there. All it seemed to do was draw a square, big or small, either side of the main window if you got close to the edge. No idea what that was used for (the small square is barely noticeable).

The window size is cruicial btw, it's a multiple of 180 (in this case 4x) so if you change the main window size, you'll need to change the divisor.

Just hook them up the same, one on analog 0 and the other on analog 1

e: oh and uncomment these two lines out in the arduino code
//pinMode(servoPin2,OUTPUT); // Set servoPin2 to be an output pin
//servo2.attach(servoPin2); // Attach a second servo

just delete the // in front of both lines and re-upload to the arduino
07:55pm 15/06/14 Permalink
trillion
Gladstone, Queensland
3568 posts
alright there's error in the setup function with variable scope declarations by just hacking those snippets in there. i'll clean it up and merge it into the project on googlecode later

thank you for the info though dude, if i could paypal you a fiver for your skills i would (maybe pm me)
09:54pm 15/06/14 Permalink
baz
Victoria
595 posts
If I saw one of those things on the road I would swerve over the top of it.

Just sayin.
10:11pm 15/06/14 Permalink
Whoop
Brisbane, Queensland
23017 posts
are you sure you only deleted the first set of //'s? either way, complete (tested working) code: http://pastebin.com/bR2ResZp

My ability to copy / paste and hit the delete button are hardly worth any money.

If there's still any errors, it's because I've been doing the testing on my laptop because it's where the arduinos be at, and posting on AG on the main PC. So I've been copy / pasting stuff between the two (even though I have a central read / write share on the network but I'm too lazy to use it).

If I saw one of those things on the road I would swerve over the top of it.

Just sayin.

Then you would probably be arrested. It's wall / ceiling mounted and if you saw it on "the road" you're probably drunk and / or high and driving through someone's living room.
11:20pm 15/06/14 Permalink
baz
Victoria
596 posts
I would drive through someones living room just to hit one of those.

I don't like em...they s*** me.
12:11am 16/06/14 Permalink
Whoop
Brisbane, Queensland
23021 posts
I wonder if there's a way to use a couple of side sensors and a front one to detect a person and track them. This has my interest piqued.

Step 1: make it track things
step 2: ...?????
step 3: skynet
10:48pm 16/06/14 Permalink
trillion
Gladstone, Queensland
3570 posts
with the kinect sdk this would have been possible :)
08:53am 17/06/14 Permalink
trillion
Gladstone, Queensland
3571 posts
not sure that the arduino as any .net com bindings that aren't hacks though, which seems like a shame because it's a great accessory once you can use it to experiment with on other oop applications
02:13pm 17/06/14 Permalink
trillion
Gladstone, Queensland
3572 posts
this might just be crazy enough to eventually compile

http://i.imgur.com/FFha6k9.jpg
07:01pm 17/06/14 Permalink
ph33x
Thailand
2147 posts
I would drive through someones living room just to hit one of those.

I'd drive my living room through your car just to get a triple cheeseburger.
09:23am 18/06/14 Permalink
Whoop
Brisbane, Queensland
23024 posts
Visual c#? Is that what you're using to code it?
10:08am 18/06/14 Permalink
Dazhel
Gold Coast, Queensland
6495 posts
#includes in C# code? wat? I might be missing something but I don't think that's going to work.

Have you tried using the Arduino IDE trillion, it's much simpler from a beginner's perspective than climbing the .NET mountain.
http://arduino.cc/en/Main/Software

Edit: nevermind, I see you're trying to control the bizness with a gamepad.
#includes are a C/C++ thing though. To leverage libraries in C# you reference pre-built assemblies with 'using' statements instead of pulling in headers and combining machine object code with your code at the link stage of compiling.
03:47pm 18/06/14 Permalink
Whoop
Brisbane, Queensland
23026 posts
^^ That's why I asked why he's using visual C#. Either way it doesn't matter what he codes it in because to upload it he'll have to open it in the arduino IDE (I think). Hell, I use notepad++ for my copy / paste style "coding" (if you can call what I do coding) then open it in the arduino ide to upload.
07:59pm 18/06/14 Permalink
system
Internet
--
07:59pm 18/06/14 Permalink
AusGamers Forums
Show: per page
1
Post a Reply
You must be logged in to post a reply.