Jawduino and inmoov

I cannot get the code Jawduino to control my servo. I am using an arduino micro an ez-robot servo. I followed this tutorial http://buttonbanger.com/?page_id=137.

Please post your program and describe in as much detail as possible what happens when you run it.

If you are getting a compiler error message then please also post the error message.

...R

PS .. When posting code please use the code button </>
codeButton.png

so your code 
looks like this

and is easy to copy to a text editor See How to use the Forum

I did try this on an arduino uno and an arduino micro.

/***********************************************************
08-14-2011 Mike North This is a little proof of concept 
to make a servo move in sync with audio.
*******************/
#include "SoftRcPulseOut.h"
#define TEST_PIN 11 //pin 11 set to ground will kick off the servo sweep test
int audio_value = 0;
long lastMsg = 0;
long sleepWindow = 300000; //if 5 minutes go by with no signal, then put the servos to bed
SoftRcPulseOut servo;
volatile boolean servosEnabled = false;
volatile boolean ledsOn = true;
volatile unsigned long currentTime = 0;
volatile unsigned long lastLEDtime = 0;
unsigned long resetWait = 120000; //servos sleep if not changed within this time frame (120 secs)

void setup()
{
	set_minmax();
	pinMode(TEST_PIN,INPUT);  //pin 11 will be 
	digitalWrite(TEST_PIN,HIGH); //assign pull-up resistor
} 

void loop()
{
  servo_test();
  audio_updates(); //read sample from audio input and apply average to buffer
  if(servosEnabled) 
  {
	action(); //servos are handled in the action loop
	SoftRcPulseOut::refresh();
	if((millis() - lastMsg) > sleepWindow)
	  detach_servos();
  }
} 
void attach_servos()
{   // attach the pin to the servo object
    servo.attach(2);
    servosEnabled = true;
}
void detach_servos()
{   // detach the servo objects
    servo.detach();
    servosEnabled = false;
}
void servo_test()
{
	if(digitalRead(TEST_PIN) == HIGH) return;
	attach_servos();
	SoftRcPulseOut::refresh();
	for(int i = 0; i < 360;i++)
	{
		if(i < 180)
			audio_value = i;
		else
			audio_value = 359 - i;
		action();
		for(int i = 0; i < 11; i++)
		{
		   delay(1); 
		   SoftRcPulseOut::refresh();
		}
	}
	detach_servos();
}
void audio_updates()
{
	audio_value = 0;
	if(analogRead(A0) < 341) audio_value += 60;
	if(analogRead(A1) < 341) audio_value += 60;
	if(analogRead(A2) < 341) audio_value += 60;

	if(audio_value > 0) 
	{
		lastMsg = millis(); //save the time stamp from when we last had some action
		if(!servosEnabled)attach_servos();
	}
}
void action() { 
  if (!servosEnabled) attach_servos();
  servo.write(audio_value);
  SoftRcPulseOut::refresh();
} 
void set_minmax()
{
	//set the first parameter in the following functions to a number between 0 and 180.
	//I used 92 and 72 in my tests to give about 20 degrees of motion.
	//You may swap the large and small numbers to reverse direction.
	//Just play with them, upload the code, then ground pin 11 to run the sweep test.
	// Be sure to only play with these numbers while the jaw linkage is disconnected,
	//  otherwise, you risk hitting mechanical limits and damaging your linkage or servo!
	servo.setMinimumPulse(map(92,0,180,512,2400));
	servo.setMaximumPulse(map(72,0,180,512,2400));
}

Autiboy:
I did try this on an arduino uno and an arduino micro.

And what happened?

...R

The servo would not move.

I am not familiar with the SoftRcPulseOut library.

Why not use the regular Servo library?

If you really do need to use that library I suggest you start with a short program that does nothing except sweep the servo from side to side. In other words a version of the standard servo-sweep example.

...R

did you find an answer? Stuck also with several like errors.

I have not had time to play with the code but also i do not understand it very well so help would be apreciated.

Autiboy:
I have not had time to play with the code but also i do not understand it very well so help would be apreciated.

It's about 3 months since your last Reply here. How much time do you need?

I'm reluctant to give up my time to help you if you are not prepare to invest yours!

And what code are you referring to when you say "the code"?

...R