Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Project Guidance / Re: Yet another arduino clock
Last post by Stan_be - Today at 02:47 pm
Thank you a lot for your help! Can you recommend me a book/s or source to read from. I really want to learn to program. But obviously I know nothing.
12
Project Guidance / Re: reaction game
Last post by fredengijs - Today at 02:46 pm
// this is what we have so far but we have no clue on how to continu//


const int buttonPin1 = 2;    // the number of the pushbutton pin
const int ledPin1 =13;       // the number of the LED pin
const int buttonPin2 = 3;    // the number of the pushbutton pin
const int ledPin2 =11;       // the number of the LED pin
const int buttonPin3 = 4;    // the number of the pushbutton pin
const int ledPin3 =10;       // the number of the LED pin
const int buttonPin4 = 5;    // the number of the pushbutton pin
const int ledPin4 =9;        // the number of the LED pin

// Variables will change:
int buttonState1;             // the current reading from the input pin
int lastButtonState1 = LOW;   // the previous reading from the input pin
int buttonState2;             // the current reading from the input pin
int lastButtonState2 = LOW;   // the previous reading from the input pin
int buttonState3;             // the current reading from the input pin
int lastButtonState3 = LOW;   // the previous reading from the input pin
int buttonState4;             // the current reading from the input pin
int lastButtonState4 = LOW;   // the previous reading from the input pin

long lastDebounceTime1 = 0;   // the last time the output pin was toggled
long debounceDelay1 = 50;     // the debounce time; increase if the output flickers
long lastDebounceTime2 = 0;   // the last time the output pin was toggled
long debounceDelay2 = 50;     // the debounce time; increase if the output flickers
long lastDebounceTime3 = 0;   // the last time the output pin was toggled
long debounceDelay3 = 50;     // the debounce time; increase if the output flickers
long lastDebounceTime4 = 0;   // the last time the output pin was toggled
long debounceDelay4 = 50;     // the debounce time; increase if the output flickers

int ledState1 = LOW;             // ledState used to set the LED
long previousMillis1 = 0;        // will store last time LED was updated
int ledState2 = LOW;             // ledState used to set the LED
long previousMillis2 = 0;        // will store last time LED was updated
int ledState3 = LOW;             // ledState used to set the LED
long previousMillis3 = 0;        // will store last time LED was updated
int ledState4 = LOW;             // ledState used to set the LED
long previousMillis4 = 0;        // will store last time LED was updated

int y = 0;
int a = 0;
int b = 0;
int c = 0;

void setup()
{
  pinMode(buttonPin1, INPUT);
  pinMode(ledPin1, OUTPUT);

  digitalWrite(ledPin1, ledState1);
  digitalWrite(buttonPin1, buttonState1);

  pinMode(buttonPin2, INPUT);
  pinMode(ledPin2, OUTPUT);

  digitalWrite(ledPin2, ledState2);
  digitalWrite(buttonPin2, buttonState2);

  pinMode(buttonPin3, INPUT);
  pinMode(ledPin3, OUTPUT);

  digitalWrite(ledPin3, ledState3);
  digitalWrite(buttonPin3, buttonState3);

  pinMode(buttonPin4, INPUT);
  pinMode(ledPin4, OUTPUT);

  digitalWrite(ledPin4, ledState4);
  digitalWrite(buttonPin4, buttonState4);
}


void loop()
{
  // lees de knop uit
  int reading1 = digitalRead(buttonPin1);

  if (reading1 != lastButtonState1)
  {
    lastDebounceTime1 = millis();
  }
 
 
  // ga na of de knop is ingedrukt als hij langere tijd dezelfde waarde heeft
  if ((millis() - lastDebounceTime1) > debounceDelay1)
  {
    if (reading1 != buttonState1)
    {
      buttonState1 = reading1;
     
      if (buttonState1 == HIGH)
      {
       y++;
      }
    }
  }   


//led 1 knipperen
  if(y==0)
  {
    unsigned long currentMillis1 = millis();
 
    int f = 10; //Hz

    int interval = 1000/f; //sec
 
     if(currentMillis1 - previousMillis1 > interval)
     {
        previousMillis1 = currentMillis1;   

        if (ledState1 == LOW)
        {
          ledState1 = HIGH;
        }
        else
        {
          ledState1 = LOW;
        }
     }
  }
 
  if(y==1)
  {
      ledState1 = LOW;   
  }
 
  if(y==2)
  {
    y=0;
  }

  digitalWrite(ledPin1, ledState1);

  lastButtonState1 = reading1;

  // lees de knop uit
  int reading2 = digitalRead(buttonPin2);

  if (reading2 != lastButtonState2)
  {
    lastDebounceTime2 = millis();
  }
 
 
  // ga na of de knop is ingedrukt als hij langere tijd dezelfde waarde heeft
  if ((millis() - lastDebounceTime2) > debounceDelay2)
  {
    if (reading2 != buttonState2)
    {
      buttonState2 = reading2;
     
      if (buttonState2 == HIGH)
      {
       a++;
      }
    }
  }   


//led 2 knipperen
  if(a==0)
  {
    unsigned long currentMillis = millis();
 
    int f = 10; //Hz

    int interval = 1000/f; //sec
 
     if(currentMillis - previousMillis2 > interval)
     {
        previousMillis2 = currentMillis;   

        if (ledState2 == LOW)
        {
          ledState2 = HIGH;
        }
        else
        {
          ledState2 = LOW;
        }
     }
  }
 
  if(a==1)
  {
      ledState2 = LOW;   
  }
 
  if(a==2)
  {
    a=0;
  }

  digitalWrite(ledPin2, ledState2);

  lastButtonState2 = reading2;

  // lees de knop uit
  int reading3 = digitalRead(buttonPin3);

  if (reading2 != lastButtonState2)
  {
    lastDebounceTime3 = millis();
  }
 
 
  // ga na of de knop is ingedrukt als hij langere tijd dezelfde waarde heeft
  if ((millis() - lastDebounceTime3) > debounceDelay3)
  {
    if (reading3 != buttonState3)
    {
      buttonState3 = reading3;
     
      if (buttonState3 == HIGH)
      {
       b++;
      }
    }
  }   


//led 3 knipperen
  if(b==0)
  {
    unsigned long currentMillis = millis();
 
    int f = 10; //Hz

    int interval = 1000/f; //sec
 
     if(currentMillis - previousMillis3 > interval)
     {
        previousMillis3 = currentMillis;   

        if (ledState3 == LOW)
        {
          ledState3 = HIGH;
        }
        else
        {
          ledState3 = LOW;
        }
     }
  }
 
  if(b==1)
  {
      ledState3 = LOW;   
  }
 
  if(b==2)
  {
    b=0;
  }

  digitalWrite(ledPin3, ledState3);

  lastButtonState3 = reading3;

  // lees de knop uit
  int reading4 = digitalRead(buttonPin4);

  if (reading4 != lastButtonState4)
  {
    lastDebounceTime4 = millis();
  }
 
 
  // ga na of de knop is ingedrukt als hij langere tijd dezelfde waarde heeft
  if ((millis() - lastDebounceTime4) > debounceDelay4)
  {
    if (reading4 != buttonState4)
    {
      buttonState4 = reading4;
     
      if (buttonState4 == HIGH)
      {
       c++;
      }
    }
  }   


//led 4 knipperen
  if(c==0)
  {
    unsigned long currentMillis = millis();
 
    int f = 10; //Hz

    int interval = 1000/f; //sec
 
     if(currentMillis - previousMillis4 > interval)
     {
        previousMillis4 = currentMillis;   

        if (ledState4 == LOW)
        {
          ledState4 = HIGH;
        }
        else
        {
          ledState4 = LOW;
        }
     }
  }
 
  if(c==1)
  {
      ledState4 = LOW;   
  }
 
  if(c==2)
  {
    c=0;
  }

  digitalWrite(ledPin4, ledState4);

  lastButtonState4 = reading4;
}

 
13
General Electronics / Re: Transistor and arduino PWM
Last post by mOskit - Today at 02:46 pm
Right sorry for not making it clear.

Story looks like this.
this is the display i have
http://www.buydisplay.com/default/serial-spi-3-2-inch-tft-lcd-module-display-ili9341-power-than-sainsmart -> backlight current 120mA

The "vibrator" god knows. some generic chinese c.ap but does shake if i put 3.3V from power supply.

3.3V is needed to power those leds. Did not reed the whole datasheet but they use only one pin for power on the flexible FPC.


14
Good afternoon cr0sh. Yes I mean that. the cloche is here intended as the handle of the joystick. And as you said I need the code to let joysticks to control the left and right motors in a virtual reality excavator. And rightly as the two joysticks come close to the center the virtual excavator decreases the speed viceversa with increasing of distance from the center.
The code for the turn (right and left) needs to be done in order to permits the user to (take close right joystick and contemporary move forward the left one) turn right and viceversa to do the left turn.
To go straight with excavator (is a Bobcat T180) the joysticks requests to take both forward and viceversa to go back.
Upon each joystick I've installed a playstation stick. The principle is to let user controlling the blade (opening, closure) with right stick -upon the right joystick-. The second stick is set upon the left joystick to control the carriage (up an down movements).
The two sticks has to go just straight and back. Thats it.
You said right could be dead simple but It's my first experience with arduino and I've used  Makey Makey till now. The makey makey problem is that it's just 0-1 input command and 0-1 command which clearly produce problem when user starts to use it.
Further theres also another thing. To let the sticks functioning you need a progressive command which makey doesn't have forcing you to buy another type of command.
15
General Electronics / Re: Linear variable differenti...
Last post by rasah - Today at 02:45 pm
thank u aarg!

but what is the 'bench testing'?
16
Bar Sport / Re: [OT ITA] Lo spamm bar
Last post by Etemenanki - Today at 02:45 pm
Col VR46 puoi sverniciare, far vedere le chiappe, salire su i podi. :D
Pero' non puoi farci lampeggiare un led :P :D
18
thanks keithsw1111! You are really helpful! interesting.. I will let You know if that works!
19
Programming Questions / Re: servo signal pin
Last post by septillion - Today at 02:44 pm
It can be any pin, even a analog pin. There is no downside. The library just uses digitalWrite to drive the selected pin. The library only disables the PWM function of pins 9 and 10 on the Uno.
20
General Electronics / safe storage temperature
Last post by nmmbeginner - Today at 02:44 pm
ok guys so i have a problem. right now my electronic work area is in the basement and i am running out of space. so i thought that i might move to my shed that is in the back yard. but the shed is not climate controlled and so it gets really hot ( like a max of 102 F) in the summer and cold ( below freezing) in the winter. i guess my question is it this an ok place to keep my arduinos and other electronic things or not. right now it dose get a little damp in there but i can fix that by putting the windows on and keeping the door shut.   
Pages: 1 [2] 3 4 ... 10