Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 36
61  Using Arduino / Project Guidance / Re: Need help with LED + button projekt. on: June 18, 2014, 06:12:45 am
Is your code able to compile?
Code:

const int startButtonPin = 13;     // the number of the pushbutton pin
int startButtonState = 0;

const int lampeLEDPin =  12;      // the number of the LED pin
int lampeLEDPinState = LOW;

int numberOfGamers = 5;

const int gameButtonPins[] = {
  3, 5, 7, 9, 11
};
int gameButtonStates[] = {
  0, 0, 0, 0, 0
};
boolean isGameButtonPressed[] = {
  false, false, false, false, false
};
int gameWinner = 0;

int numberOfButtonsPressed = 0;
int numberToWin = 2; // Winner knappen (anden gang en knap bliver trykket)


const int gameLEDPins[] = {
  2, 4, 6, 8, 10
};
int gameLEDStates[] = {
  LOW, LOW, LOW, LOW, LOW
};

boolean isGameOn = false;
boolean hasGameBeenPlayed = false;


void setup() {
  Serial.begin(9600);

  pinMode(startButtonPin, INPUT);
  pinMode(lampeLEDPin, OUTPUT);

  int i = 0;
  while (i < numberOfGamers) {
    pinMode(gameButtonPins[i], INPUT);
    pinMode(gameLEDPins[i], OUTPUT);

    i = i + 1;
  }

}

void loop() {
  startButtonState = digitalRead(startButtonPin);

  Serial.print("isGameOn: ");
  Serial.println(isGameOn);

  if (startButtonState == HIGH && isGameOn == false) {
    isGameOn = true;
  }

  if (isGameOn) {
    lampeLEDPinState = HIGH;

    for (int i = 0; i < numberOfGamers; i = i + 1) {
      gameButtonStates[i] = digitalRead(gameButtonPins[i]);

      if (gameButtonStates[i] == HIGH && isGameButtonPressed[i] == false) {
        isGameButtonPressed[i] = true;
        numberOfButtonsPressed = numberOfButtonsPressed + 1;
        gameLEDStates[i] = false;
      }

      if (numberOfButtonsPressed == numberToWin) {
        isGameOn = false;
        hasGameBeenPlayed = true;
        gameWinner = gameButtonPins[i];
      }
    }
  }
  else {
    lampeLEDPinState = LOW;
    numberOfButtonsPressed = 0;
    for (int i = 0; i < numberOfGamers; i ++) {
      isGameButtonPressed[i] = false;
      if (i != gameWinner) {
        gameLEDStates[i] = LOW;
      }
      digitalWrite(gameLEDPins[i], gameLEDStates[i]);
    }
  }


  if (hasGameBeenPlayed == true) {
    gameLEDStates[gameWinner] = HIGH;
  }

  for (int i = 0; i < numberOfGamers; i = i + 1) {
    digitalWrite(gameLEDPins[i], gameLEDStates[i]);
  }

  digitalWrite(lampeLEDPin, lampeLEDPinState);
}
62  Using Arduino / General Electronics / Re: [Help on searchig] IC for switching ON \ OFF on: June 16, 2014, 05:15:06 am
How you connect the P-MOS? the "IN" point connected to P-MOS "S", the "OUT" point connected "D"
63  Using Arduino / Project Guidance / Re: Potentiometer Controlled LEDs on: June 13, 2014, 06:31:50 pm
Code:
int sensorValue = analogRead(A0);

void setup() {

  Serial.begin(9600);
  pinMode(2, OUTPUT);
}


void loop() {
  sensorValue = analogRead(A0);  // You have to remove the int
  Serial.println(sensorValue);
  delay(10);
  led();
}


void led() {
   
    if(sensorValue > 0)
    {
      digitalWrite(2, HIGH)
    } 
  }
64  Using Arduino / Project Guidance / Re: Potentiometer Controlled LEDs on: June 13, 2014, 06:19:56 pm
Code:
int sensorValue = analogRead(A0);

void setup() {

  Serial.begin(9600);
}


void loop() {
  sensorValue = analogRead(A0);  // You have to remove the int
  Serial.println(sensorValue);
  delay(10);
  led();
}


void led() {
    
    if(sensorValue > 0)
    {
      pinMode(2, OUTPUT);
    }
  }
65  Using Arduino / Project Guidance / Re: Remotely Swith On Laser Not Attached to Arduino or ATMEGA Chip on: June 12, 2014, 05:21:42 pm
You can use slip ring.
Quote
A slip ring is an electromechanical device that allows the transmission of power and electrical signals from a stationary to a rotating structure.
66  Using Arduino / Project Guidance / Re: What does it mean when I can't upload my program? on: June 09, 2014, 06:24:50 am
I try to compile your new code and this is what get

Quote
Sketch uses 7,120 bytes (24%) of program storage space. Maximum is 28,672 bytes.
Global variables use 2,324 bytes (90%) of dynamic memory, leaving 236 bytes for local variables. Maximum is 2,560 bytes.
Low memory available, stability problems may occur
and you have few more local variables, this may be the problem.
67  Using Arduino / Project Guidance / Re: Arduino and ATmega DIP40 on: June 08, 2014, 05:26:35 pm
Alot of work had done for Atmega32
www.instructables.com/id/Arduino-on-all-sorts-of-Atmels/?ALLSTEPS
https://github.com/eaconner/ATmega32-Arduino
http://forum.arduino.cc/index.php?topic=149677.0
68  Using Arduino / Project Guidance / Re: Arduino Development Board? on: June 07, 2014, 08:26:05 pm
In general for reliable operation of any digital IC you need a bypass or decoupling capacitor as close to its power pin as possible.  If the IC has more than one power pin then you need more than one capacitor.  Atmel recommends one for the AVcc pin as well.
The Aref pin had to wire a .1ufd bypass cap from that pin to ground for a slight noise reduction improvement for AnalogReads.

These are some info what other had done.

https://learn.adafruit.com/standalone-avr-chip-programmer?view=all


ISP Shield for Arduino
http://shop.evilmadscientist.com/productsmenu/tinykitlist/253
69  Using Arduino / General Electronics / Re: My DS1302 RTC gets ahead of real time on: June 06, 2014, 10:28:45 pm
If your drift more or less constant daily, you may try the way on this link

DS1307 RTC adjust drift automatically
70  Using Arduino / Project Guidance / Re: Laser Communication on: June 06, 2014, 06:30:52 am
http://www.instructables.com/id/Laser-Transceiver/?ALLSTEPS

Just be aware that photo resistors react too slowly.  They will take some time from they have been exposed to light to they are back to their "dark resistance".
A photo transistor would probably be a better solution in your case.

This might be interessting:

http://blog.makezine.com/2008/08/13/laser-modem-with-an-ardui/
http://www.ohmpie.com/laserModem/
http://pyevolve.sourceforge.net/wordpress/?p=2383
Try to google "Arduino laser modem" that should give you something to go with.
71  Using Arduino / Project Guidance / Re: Moving ATX powersupply pcb to another box on: June 04, 2014, 06:40:53 am
You can get one of this to modify

http://www.fasttech.com/products/0/10001558/1116201-led-pc-computer-atx-hdd-sata-power-supply-tester


or you can get a 24-pin ATX Power Extension Cable that have male 24-pin ATX connector as well as a female 24-pin connector from ebay and cut the cable to re-use the connector.
72  Using Arduino / Project Guidance / Re: how to install an operating system in arduino duemilanove fritzing atmeg1 168 on: June 03, 2014, 08:18:54 am

i am already sketch ArdOS libraries its working properly.

my question is how to installed ArdOS on atmega168 microcontroller ? actually i am adding libraries to ide not installing am i write . i am beginner learning microcontroller programming can u please help me

thanking you in advacnce
ArdOS installed as a libraries form but it provide the OS kernel for the RTOS functions like scheduling, semaphores & Queues.

Can you explain what role you envisage for the operating system?

Edit:
Something for you to read
http://ossec.es2.be/Portals/6/Users/082/82/82/Nicolas_Pantano_report.pdf
73  Using Arduino / Project Guidance / Re: how to install an operating system in arduino duemilanove fritzing atmeg1 168 on: June 03, 2014, 05:47:23 am
ArdOS: The Arduino Operating System. Now for the Arduino IDE!
http://forum.arduino.cc/index.php?topic=170305.0

Edit:
NilRTOS - A Fast Tiny Preemptive RTOS
http://forum.arduino.cc/index.php?topic=144715.0

Article on Arduino Real Time
74  Using Arduino / Project Guidance / Re: Arduino Robot won't follow line on: June 02, 2014, 08:35:41 am
I had compile the example line following programs using IDE 1.5.6-r2, these was the message shown

Quote
Sketch uses 28,616 bytes (99%) of program storage space. Maximum is 28,672 bytes.
Global variables use 2,092 bytes (81%) of dynamic memory, leaving 468 bytes for local variables. Maximum is 2,560 bytes.
Low memory available, stability problems may occur
75  Using Arduino / Project Guidance / Re: Determining required RAM size on: June 02, 2014, 07:37:43 am
The current version IDE Arduino 1.5.6-r2

Code:
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}
Quote
Sketch uses 466 bytes (1%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
Pages: 1 ... 3 4 [5] 6 7 ... 36