Recent Posts

Pages: [1] 2 3 ... 10
1
I'd stay away from floats it at all possible (slows down the 8-bit processor a lot). I mean, do you really need to convert the number to a percentage? Who cares how the throttle value is represented as long as the robot behaves as required?
2
If you want multiple PWM outputs, you need multiple analogWrite() calls with each call addressed to different PWM pins. Is that what you are asking? You question/explanation is very difficult to follow.
3
Why are you only using accellerometer data? Why not also add gyroscope data using a complimentary filter? The output of the filter will give you the tilt angle in degrees.

Even if you don't do a complimentary filter, you need to at least do a digital low pass filter for the accellerometer data. Raw accellerometer data is rather noisy.

I would also double check the range of values your accellerometer outputs from 0 to 1g.
4
One of the older IDE's had this issue but you haven't mentioned much information so its just a guess.

Also no sketch or schematic posted so not sure it it is that ?

5
Thanks, good luck & have fun.
6
I want to modify this code and be able to control the servo using matrix keypad and not by serial monitor. I've tried changing Serial.Available() and Serial.parseInt() into the declared input but to no avail. What should I replace  Serial.Available() and Serial.parseInt() with? Please help me out. Thanks.

Code: [Select]
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <Servo.h>

LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);//RS,EN,D4,D5,D6,D7

const byte Rows= 4; //number of rows on the keypad i.e. 4
const byte Cols= 3; //number of columns on the keypad i,e, 3

//we will definne the key map as on the key pad:

char keymap[Rows][Cols]={
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};

byte rowPins[Rows]= {3,4,5,6}; //Rows 0 to 3
byte colPins[Cols]= {7,8,9}; //Columns 0 to 2

Keypad kpd= Keypad(makeKeymap(keymap), rowPins, colPins, Rows, Cols);

Servo servoOne;
Servo servoFive;
Servo servoTen;

void setup() {
  // put your setup code here, to run once:
lcd.begin(20, 4);//initializing LCD
servoOne.attach(10);
servoFive.attach(11);
servoTen.attach(12);

}

void loop() {
  // put your main code here, to run repeatedly:
 
char select = kpd.getKey();
char input = kpd.getKey();

  lcd.setCursor(0,0);
  lcd.print("Select denomination");
  lcd.setCursor(0,1);
  lcd.print("1=One 2=Five 3=Ten");
 
   if (select=='1'){
     
   
      lcd.setCursor(0,0);
      lcd.print("Enter 1-peso coins");
      lcd.setCursor(0,1);
      lcd.print(input);   
     
      servoOne.write(120);
      delay(10);
         while (Serial.available() > 0)
         {
          int x = Serial.parseInt();
             while (x>0)
             {
               servoOne.write(40);  // Turn Servo Left to 45 degrees
               delay(170);          // Wait 1 second
               servoOne.write(120);   // Turn Servo Left to 0 degrees
               delay(170);          // Wait 1 second
               x--;  // wait for a second
            }
         }
     }

     else if (select=='2'){
     
   
      lcd.setCursor(0,0);
      lcd.print("Enter 5-peso coins");
      lcd.setCursor(0,1);
      lcd.print(input);   
     
      servoOne.write(120);
      delay(10);
         while (Serial.available() > 0)
         {
          int x = Serial.parseInt();
             while (x>0)
             {
               servoOne.write(40);  // Turn Servo Left to 45 degrees
               delay(170);          // Wait 1 second
               servoOne.write(120);   // Turn Servo Left to 0 degrees
               delay(170);          // Wait 1 second
               x--;  // wait for a second
            }
         }
     }

      else if (select=='3'){
     
   
      lcd.setCursor(0,0);
      lcd.print("Enter 10-peso coins");
      lcd.setCursor(0,1);
      lcd.print(input);   
     
      servoOne.write(120);
      delay(10);
         while (Serial.available() > 0)
         {
          int x = Serial.parseInt();
             while (x>0)
             {
               servoOne.write(40);  // Turn Servo Left to 45 degrees
               delay(170);          // Wait 1 second
               servoOne.write(120);   // Turn Servo Left to 0 degrees
               delay(170);          // Wait 1 second
               x--;  // wait for a second
            }
         }
     }
}
7
If you have another Arduino (or an ICSP device) you could load up a blank sketch etc using one as an ICSP.
There is also the "hit the reset button" during the upload phase that often works.

8
What I have done in these cases is to use a differential line receiver and transmitter.
At the sending end use a AM26LS31 driver. Then connect the two wires per signal at the far end to a AM26LS32A receiver. You get four drivers per package. You also need a common ground signal but only one for all the drivers and receivers.

I have found this gives a very solid signal even at high data rates.
Thanks a lot for that suggestion. That's something I will try. But it needs two Arduino boards at all end points. Isn't it? I thought about doing all with single board.
9
Is it by any chance a clone board ?
If it is you need these drivers from here.
Ignore that it is a Chinese site as these are the correct drivers for most clones !

Obviously Arduino does not supply drivers for copycat clones.
Although the online IDE does support them out of the box.

10
I've been getting my feet wet with Arduino. Coming from a background of using scripted languages, I'm having a bit of a harder time with C++.

I understand that C++ is WAY faster and more efficient than something like Ruby or especially Javascript, but in this day and age memory and processing power is cheap. It shouldn't be that much more expensive to outfit an Arduino with more memory and faster processing so that it can run higher level languages very quickly.

So I'm guessing that the main reason the Arduino has low memory and clock speed is that it saves the most power?

I guess another related question would be: why doesn't the Raspberry Pi just have tons of analog pins like the Arduino? A RPi Zero isn't that much more expensive than an Arduino Mega for example.
Pages: [1] 2 3 ... 10