Hot answers tagged

4

I don't know enough about how tapes work to comment on the sense of what you're doing, but some problems with the code: You are reading the input and setting buttonstate once only in setup(). You need to read it repeatedly, by putting it in loop(). You also have three variables called state: one global which is never set, and two with very restricted scope ...


2

You have created a flow chart. When discussing state machines it is better to use a state diagram. In this state diagram of a turnstile (from the state machine wikipedia page linked to above) it is observed that the nodes (bubbles) contain the state of the turnstile and on the edges (arrows) is written the condition required to travel in the direction of ...


2

Depending on the type of stepper motor the answer can be "Yes" or "No". There are two types of stepper motor: Unipolar and Bipolar. Bipolar motors typically have 4 wires and require a H-bridge to drive them. The L239D is a popular (and cheap), though inefficient, H-bridge that is commonly used. But it is possible to build your own H-bridge from discrete ...


1

Previously I was powering everything off of the 5V line on the Arduino, but I just switched to using an external battery pack of 4 AAs and that seems to work fine. That suggests, that your power source was not strong enough. You didn't say, how you are powering the Arduino, but I guess you are doing so via USB. The USB port of a PC can only give you 500mA ...


1

Here the proper answer: The vast majority of devices are constant-voltage devices. They need a constant operating voltage to work correctly. Microcontrollers are such devices. When operating, they will try to draw as much current from the power source, as they need, but not more. Much like a simple resistor with an applied voltage will draw a specific ...


1

Each state in the state machine should be a state in which the arduino will be for a time. Anywhere you would use a delay() or a blocking function or a busy loop will be a state. You can also use multiple orthogonal statemachines and mix them. For example 1 to control whether the motor needs to be driven at all and one to control which direction it is ...


1

If you are using l293d you must control the voltage on its ENABLE PIN rather than controlling it on other INPUT PINS (l293d). Here is simple tutorial on controlling the Motor using L293d. here. And @VE7JRO is right about map() function as your are passing the values that are out of range please take care of that part as well.


1

analogRead() returns an integer between 0 and 1023. Using 30 and 400 in the map() function, then passing in a value outside of that range will cause strange results. Here is a sketch to illustrate my point. void setup(){ Serial.begin(9600); // Prints -20 to 684 for(int i = 0; i < 1024; i++){ Serial.println(map(i, 30, 400, 0, 255)); } ...


1

With out knowing the demands of the motors (how much current they need under a given load) it is difficult to answer your question. But, in most Arduino designs: Motors are powered independently of the Arduino. And when Arduino Uno is powered through its USB port it should be realized that most common USB power sources are only obliged to offer up to ...


Only top voted, non community-wiki answers of a minimum length are eligible