Show Posts
Pages: 1 [2] 3 4 ... 81
16  Using Arduino / Programming Questions / Re: HELP~Help~Serial Write and Read of 2byte number on: June 30, 2011, 12:17:18 am
A byte is 8 bits and cover values from 0 to 255. If you made it unsigned instead of signed, you could also use values between 128 and 255.

For 512, you're out of luck, you won't be able to make it work with a single byte. You need to send 2 bytes and on the Arduino you need to read 2 bytes  before you can reassemble them into a 16-but integer and process it. You should take care to assemble the value in the right order (high byte / low byte first) so that the Arduino gets the value you sent and not something else.

You also should  think about how you keep the sender and the Arduino in sync. Because if the Arduino thinks the second byte is the first, all will look fine to both parties but the received data will all be wrong.

Korman
17  Using Arduino / Project Guidance / Re: Kitty Invisible fence on: June 30, 2011, 12:06:39 am
This kind of project isn't very well suited for the Arduino, because the success of the project lies in having a small, light, unobstructive  collar for the animal. If you want to attach and Arduino to your cat, better attach a brick - that's just as effective and a lot more appealing.

The system probably works with very short range transmitters (perhaps some wire buried)  and the pet has a receiver around its neck. When the receiver receives the signal, it buzzes the animal.

Korman
18  Using Arduino / Project Guidance / Re: Arduion Remote Webcam Station on: June 29, 2011, 11:55:59 pm
Can the ardunio store a image taken from a camera then covert the binary in to hex and send it to my base station?

No, not enough RAM for that. If the camera can freeze a frame so that you can read and process the image piecewise, you might have a chance. But buffering a whole image is out of the scope of an Arduino.

Also, the protocol you write about seems to be very simplistic and unsuitable for the task. As if someone tried to reinvent the wheel without bothering to read up on what worked before.

Korman
19  Topics / Interactive Art / Re: Maxbotix EZ0 to RGB LED on: June 29, 2011, 03:36:15 pm
Mark,

it's hard to help you here without you providing more data. The code looks ok and as if it was doing something. If that something is what you want or need is another matter.

Quote
I have this working to some degree, but it is very, very jumpy.

Well here we have the core of the problem. It could be many things.

First you should investigate the behaviour of sensorValue. If the input data itself is jumpy, expecting anything besides a jumpy output would be unreasonable. Also pay attention how well the range from sensorMin to sensorMax is used. If after your calibration sensorValue jumps mostly between too low and too high, you have a problem to work on. Also if the spread between sensorMin and sensorMax is below the output range of 256 levels, map() won't take advantage of the additional levels in between. You'll have to fix the jumpiness in other ways in this case.

Once you get reasonable smooth input values, you then can start working on the output side if the problem persists. Here again, you need to investigate what kind of jumpiness you see. You might end up to rework you mapping algorithm to something a little better tuned to your needs than just you the plain call to the map() function. But to know which algorithm works better, you need to understand the problem first.

Perhaps this gives you some ideas on how to proceed. If you have more information, we might be able to help you more.

Korman
20  Topics / Education and Teaching / Re: Maybe I have bitten off more then I can chew. on: June 29, 2011, 03:08:22 pm
A lot of people in the homeschooling group pushed me to teach a class on "computers."  They have no idea what that means but they know their children will need it.  The kids are mostly around 12 years old. I want to give them a good foundation is what are logic circuits, what are analog circuits,  how to do procedural as well as event driven code.

First you should think about, what kind of goal has your computer course. What should the kids learn? How to use a computer in daily life, from writing, processing digital images, safe surfing to backing up one's data? How computers work and what's behind that network stuff? Making web pages? A little programming and scripting? A little computer science? Electronics? Electrical Engineering? Quantum physics and other fun with electrons in semiconductors and electromagnetic fields?

With so many topics to choose from, it's very easy to either get lost or just skimming too many topics lightly so that the kids will be left confused and nothing learned.

Make a plan where the Arduino fits in and what kind of knowledge the children will have acquired before the Arduino module starts. Will they know about current and Ohm's law? Will the know about variables and loops? Will the have an idea what an algorithm is? In my opinion this will be the driving factor on what you can do with them using the Arduino.

One of my goals in the class is to get the kids to learn the math involved.  That is a major aspect of my goals.  When a person is young they do mostly very boring work sheets in math class.  I want to show them that it actually has uses in the real world.  I thought doing arduino would be a good place to do that.

I doubt it. At that age the children should be beyond simple sums, multiplication and fractions, but that's most of the maths involved with the Arduino. You can teach many things with the Arduino, but maths ain't one.

The first book I bought is "Getting Started with Arduino" by Massimo Manzi.  I also found a lot of stuff online, especially on youtube, that give good examples.

The book is good, one of the better ones. But as you wrote, there are lot of good and even more crappy resources on the web for this whole topic. The difficult part choosing the right ones that fit into your curriculum. And here's a shameless plug for another educational project I'm quite fond of: Computer Science unplugged

Perhaps that helped.

Korman
21  Using Arduino / Motors, Mechanics, and Power / Re: Question about Servo library on: June 29, 2011, 02:31:45 pm
So, what is the different between "Servo.h" and "SoftwareServo.h" ?

Servo.h is the library delivered with the Arduino which can use on the Duemilanove or the Uno up to 12 servos at the same time. It takes care to refresh the servos via an interrupt function connected to Timer1 and you don't have to worry about it at all. It just works. Use this one.

SoftwareServo.h is a less efficient library where you need to take care of the refresh yourself. The only reason to use it is if Timer1 is blocked by some other library and a few rare cases where Servo.h can't be used for other reasons.

As the pwn mentioned by Growler and the limit to two servos on fixed pins: Forget it. That's either hogwash or information so old that it doesn't apply to the libraries available today.

Korman
22  Using Arduino / Programming Questions / Re: trouble making a program on: June 29, 2011, 02:13:15 pm
im new in programming

Well, it's time for you to learn how to debug your code. Programming like a magpie by stealing random bits of code doesn't work. Also hoping to find someone that will fix your mess for free won't work either for very long.

but the program does nothing?

Lesson #1 in debugging: What did you change between the last time some part of the program worked and now, when it stopped working.  It's very likely that the stuff you added creates the problem, so look there.

Lesson #2 in debugging: If your code never worked, throw everything away and restart from scratch. Take small steps, add features one by one and after every step test your code to make sure your code does what it should. Before you did, don't add more stuff, it makes only the mess bigger and reduces the chance to get any working code.

Lesson #3 in debugging: Write debugging output - you did that going by the numbers of prints sprinkled through your code - and read the output produced. If you say that your program does nothing, does that mean not even the LED is blinking at the start, that you get no output. If you do get some output, is the output what you expect? If yes, a good start is to look at the part of code between the last good output and the first bad or missing output. If the output gives you unexpected values, look at the code to understand why you get those values and fix it.

Lesson #4 in debugging: Debugging is work. Debugging often is no fun. Debugging is like a jigsaw puzzle where you miss half the pieces and you're not even sure if the pieces you have are from the same puzzle. Get used to it and start doing it now. If you don't want to debug, forget about programming.

Good luck.

Korman
23  Using Arduino / Project Guidance / Re: voice activated door lock.... on: June 28, 2011, 02:19:20 pm
Without dedicated IC to deal with the voice processing part, it's unlikely that you'll go far with the Arduino alone on this project. The Arduino simply doesn't have the necessary processing power to do sound processing.

Korman



24  Using Arduino / Project Guidance / Re: K6714-16 Relay board on: June 28, 2011, 02:06:32 pm
You interface with the inputs of the ULN2803. This IC has been created just for the task of driving high current devices with low power outputs. You can connect the Arduino ports directly to them. The inputs consume below 1.5mA.

One important thing though is that you don't power the relay board from the +5V of your Arduino, that'll probably fry your Arduino. The board needs to be powered directly from a suitable power supply (which also can power the Arduino if necessary) and you need to make sure that the  ground lines of your relay board (on the primary side) is connected to the ground pin of the Arduino.

Korman
25  Using Arduino / Programming Questions / Re: Odd readings from PulseIn() command. on: June 28, 2011, 05:17:35 am
Ok, then it's time to take one step back. Read a single line and check on your oscilloscope (or servo tester) what kind of signals you get. As long as this doesn't work properly, adding two more will only confuse the matter.

Korman
26  Using Arduino / Programming Questions / Re: Odd readings from PulseIn() command. on: June 28, 2011, 04:52:06 am
What do you mean by random reading? Are the returned values random or when pulseIn() manages to find a pulse?

Korman
27  Using Arduino / Motors, Mechanics, and Power / Re: Problem with servo jittering. on: June 28, 2011, 04:27:13 am
First the easy answer, why your Servos jitter all the time in your first program: Because you tell them to.

You update them all the time at full speed with values between 1100 and 1300, but the value is used only once every 20ms or so by the interrupt function of the Servo-library. Which value is take when the next update of the servo is done is random, anything between 1100 and 1300 is possible. The result: the servos move like crazy.

What to do to resolve it? After setting the servos, give them time to move to the new position. For a test, add delay(100) at the end of the function ServosGoTo(). If you don't wait for at least 20ms, your update most likely won't be sent to the hardware. If the servos are moving to slow, increment i or j by 10 or 20 in your for loops instead of using ++.

With this, the jitter should be mostly gone except perhaps for a small tick every 10 seconds or so. If not, things will be a bit more complicated.

Korman
28  Using Arduino / Programming Questions / Re: programming <servo.h><VirtualWire.h> on: June 27, 2011, 01:30:02 pm
So, then how can i can control a servo wirelessly using RF

On the Arduino Duemilanove/Uno, both libraries use Timer1. For the Servo-library, moving to another timer isn't an option as you need the 16-bit timer and there's no other available. You'll have to rewrite the VirtualWire library to use the 8-bit timer Timer2.

That's the beauty of open source projects: Sometimes you find all pieces you need for ready to use and most work has already been done for you. Sometimes it's up to you to go ahead and make something better for those coming after you. That's the price you have to pay to get things for free. If you don't like this, go ahead an pay someone to do it for you.

Korman
29  Using Arduino / Programming Questions / Re: upload C# or Java Code to Arduino on: June 23, 2011, 01:01:29 pm
So the OP will need to brush up on procedural programming.

Not really. The original poster will need to get some basic clues first. Alone the illusion that programs written for the PC will cross-compile shows that he lacks the most basic undertanding about micro-controller, their uses and limitations. And this will prove the be the major problem for him, not to learn yet another programming language.

My advice for the original poster is to learn about the Arduino - or any other micro-controller - as a new environment with its own language. The comfort of the little programming knowledge he has will hinder him instead of making things easier. Too many things simply don't work the same way even if they look alike and have the same name.

Korman
30  Using Arduino / Programming Questions / Re: upload C# or Java Code to Arduino on: June 22, 2011, 08:48:57 am
Can somebody help about this subject

i wrote application in C# like tetris game or blink led ets. Now how can i upload that code to arduino?
Does somebody has any idea?

Yes, you'll need a hardware upgrade of the Arduino to something else with same power connector, which will run your software.

Or put it another way: Sorry son, the world doesn't work the way you imagine it does.

Korman
Pages: 1 [2] 3 4 ... 81