Show Posts
Pages: 1 2 [3] 4 5 ... 33
31  Using Arduino / Programming Questions / Re: Reset ethernet connection on: November 24, 2011, 03:58:23 pm
Quote
Sorry for all the questions
Don't worry, I don't mind! smiley

Quote
how can you determine if a site (such as google.com) has loaded or not?
http://arduino.cc/en/Reference/ClientConnect

Quote
Connect to the IP address and port specified in the constructor. The return value indicates success or failure.

Code:
if(!client.connect(  [google]  ){ //See if you can connect Note that you'll need to change [google] to google's URL/IP address
  connected = false;     //Not really needed, but it could be used if you decided on a different use...
  while(true);    //Do nothing for ever more. In reality, the watchdog will kick in and reset the board.
}

Have a look at the example for client.connect():
Code:
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte server[] = { 64, 233, 187, 99 }; // Google

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);

  delay(1000);

  Serial.println("connecting...");

  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /search?q=arduino HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;;)
      ;
  }
}

Onions.
32  Using Arduino / Networking, Protocols, and Devices / Re: Can I use my Arduino as a usb - rs232 converter? on: November 24, 2011, 03:51:52 pm
If you want to use the arduino and talk to it via USB, you'll need to look into Serial.begin and so on. When you send data to the arduino (open up the IDE, open up Serial monitor, type data into the bar at the top then press send), it will be converted to TTL by the FTDI IC. You may be able to connect the TTL serial output to your basic stamp and program it like that...
The problem is that you may end up trying to upload the program to the AVR on the arduino. That won't work. In order to get around that, you can simply unplug the IC on the through-hole, or desolder the IC on the SMD version.
Another alternative is to buy a USB to TTL convertor designed to upload a program to a pro mini, then use it for the basic stamp instead.

Try out some of the serial examples, then you can get some idea about communication.

Onions.
33  Using Arduino / Programming Questions / Re: Reset ethernet connection on: November 24, 2011, 03:44:29 pm
Quote
So the wdt_reset(); command in the loop actually stops the reset from occurring.
Yes, resetting the watchdog timer prevents the arduino from resetting.
Quote
I could therefore write a IF/ELSE statement that normally runs the wdt_reset(); command, but say every hour it runs delay(3000) instead which should provide sufficient time for the reset to occur.
Personally, I'd try and connect to a website (any would do) every few minutes. If there is no connection, the site will not load. If the site does not load, then you do not reset the watchdog and the board will reset. Doing it every hour has the disadvantage that if the connection drops at the start of the hour, that's a full hour to wait before it will work again...

Onions.
34  Using Arduino / Programming Questions / Re: Reset ethernet connection on: November 24, 2011, 03:21:02 pm
http://tushev.org/articles/electronics/48-arduino-and-watchdog-timer

Code:
#include <avr/wdt.h>  // include the library

void setup(){
  wdt_enable(WDTO_2S);  //Set up the watchdog timer. If it isn't reset every 2 seconds, the arduino will reset
}

void loop(){
  wdt_reset();  //Reset the watchdog
}

Onions.
35  Using Arduino / Networking, Protocols, and Devices / Re: Can I use my Arduino as a usb - rs232 converter? on: November 24, 2011, 03:02:34 pm
I'm sure it would be possible, but wouldn't it be cheaper and easier to just buy one?
http://www.ebay.co.uk/sch/?_nkw=USB%20-%20RS232%20convertor&clk_rvr_id=287899086462

RS232 uses -+12V signals; USB uses -+5V signals. That's one thing to account for. Also, it is not your standard TTL interface. The problem will be changing the voltage levels. It is possible to buy a TTL to RS232 chip. The arduino can output TTL data to it, which would work. I'd still use a bought one though, then use the arduino instead of the basic stamp  smiley-lol .

Onions.
36  Using Arduino / Programming Questions / Re: Reset ethernet connection on: November 24, 2011, 02:56:50 pm
Quote
Is there a way to achieve this, to either reboot the Nanode, or re-load the code which establishes a fresh connection?
http://www.google.co.uk/search?q=avr+watchdog+timer&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a

Lots of ways! You'll want to set up a watchdog timer, then  re-set it whenever there is a connection. That way, when the connection stops and the watchdog is not reset, it'll reset the actual board.

Onions.
37  Community / Exhibition / Gallery / Re: Demoing Simple Noise and Tones and Clicking on: November 20, 2011, 02:01:55 pm
@cr0sh:
The site says
Quote
"This circuit uses avalanche noise in a reverse-biased PN junction, the emitter-base junction of the first transistor. The second transistor amplifies it. The first two ALS04 inverters are biased into a linear region where they act like op amps, and they amplify it further. The third inverter amplifies it some more..."
Which basically boils down to a reversed PN junction creating random noise, which is amplified. That sounds simple smiley

@Jorh:
Quote
Luckily, our ears don't care how random the noise is.
True, a project like yours doesn't need true randomness, but then there's no harm in having some anyway...

Quote
Serial because I can't really use push buttons because I don't have a breadboard. I do have several pushbuttuns due to me disassembling random electronics
If you have a soldering iron and some loose wires, you could solder the terminals together and get away without a breadboard. If you don't have a soldering iron and some wires, you're missing out on fun!

Onions.
38  Community / Exhibition / Gallery / Re: Demoing Simple Noise and Tones and Clicking on: November 19, 2011, 02:44:00 pm
To make it sound even cooler / more random you could try
Code:
delay(random(1,20));
(Changing the values to whatever sounds coolest.

I read somewhere that a reverse biased p-n junction creates white noise, or something along those lines. I can't see how it would work, (so maybe I rememered it wrong), but apparently it does...

Onions.
39  Using Arduino / General Electronics / Re: Multi Digit Display on: November 19, 2011, 11:58:40 am
It appears to be a normal seven segment display:
http://blog.2of1.org/2010/08/27/arduino-library-for-7-segment-displays/
Or check out the playground for more examples.

Onions.
40  Using Arduino / Programming Questions / Re: Lack of Timer support for Arduino on: November 16, 2011, 03:49:42 pm
Timers are an internal piece of hardware found in side the AVR. It is probably assumed that those users capable of using timers properly will not be wanting to use a library like timer2 for it. There are many libraries created that are not included in the arduino software, generally because they are less useful or commonly used. On the other hand, timer2 does provide some very useful extra functions for users unable to use the timers...

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?
Quote
"Install it on {arduino-path}/hardware/libraries/ "

All Arduino libraries on a Windows system are under
\Program Files\Arduino\libraries\

Quote
not \Program Files\Arduino\hardware\libraries

It would appear so. You are able to edit the page, so why not correct it?

Onions.
41  Using Arduino / Programming Questions / Re: light switch. arduino does the opposite of what i need.. on: November 16, 2011, 03:44:03 pm
Code:
 temp = digitalRead(x);  
  if (temp == HIGH) {              
    digitalWrite(y, HIGH);  
  }
  else {            
    digitalWrite(y, LOW);  
  }

Can be simplified to

Code:
 temp = digitalRead(x);              
  digitalWrite(y,temp);
 

or

Code:
 digitalWrite(y, digitalRead(x));

The first code set y high if temp was high, and y low if temp was low - it sets y to the state of x, so we can do it without any if statements. In order to make it do the opposit of the first code snippet (high if low, and visa versa), we can use the ! operator:

Code:
 digitalWrite(y, !digitalRead(x));

This takes the value read from x. If it is high, it sets y to low. If it is low, it sets y to high.


Onions.
42  Development / Other Software Development / ATtiny cores for beta IDE on: November 16, 2011, 12:18:56 pm
Hello all!

I have been using the beta IDE for a while now, and I prefer it to the non-beta version. There is a problem though - the cores I have for ATtiny45/85 do not work with it. The solution? To write one!
I have attached a .zip file to the post, which contains the core for the ATtiny85. The code I tested compiles perfectly with it under the new beta IDE, however I broke my ATtiny some time ago, so I cannot test it.
For instructions on using it, I have to reconmend the HLT wiki: http://hlt.media.mit.edu/?p=1229 I used the boards.txt file, only altered, for the new core, so the pin layout will be identical to that shown in the wiki.
If there is someone using the beta IDE with a tiny85 lying around, I would be hugely greatful if they could test it for me smiley-grin . I am planning on trying to make some more cores soon, as well as altering the one presented here some more.

Onions.

---
P.S. there is no bootloader included in the file for several reasons:
1)It would take up too much memory,
2)The ATtiny45/85 has no UART, so it would not be at all beneficial,
3)I don't know how to write one.
Also, upload is via arduino as ISP, just like it shows in the HLT wiki.
43  Using Arduino / Project Guidance / Re: Mini Forklift? on: November 15, 2011, 12:15:40 pm
Have a look into linear acutators:
http://en.wikipedia.org/wiki/Linear_actuator

They provide the up-down movement a forklift will need.

Onions.
44  Using Arduino / Project Guidance / Re: Atmega328 freezes on: November 12, 2011, 03:43:55 pm
Set it up as shown below, and it will work fine. As you have taken the IC out of your arduino, it wil already have a bootloader on it, so ignore the bootloader burning bit.
http://arduino.cc/en/Tutorial/ArduinoToBreadboard

Onions.
45  Community / Exhibition / Gallery / Re: Another Hexapod Walking Robot :-) on: November 12, 2011, 03:34:14 pm
Would there be any codes for it? smiley-grin I'm intruigued as to how you managed to get all the legs to work in such a smooth way. I remember one video I saw of a robot managing to 'jump' its way along, as the servo movements were not timed correctly. Although it looked funny, it is still better than what I have done (which is nothing, when it comes to walking robots. Nothing yet...).
It looks like a quality product, well done!

Onions.
Pages: 1 2 [3] 4 5 ... 33