Show Posts
Pages: [1] 2 3 ... 3291
1  Using Arduino / Programming Questions / Re: Individual servo control using flex sensor readings on: Today at 04:38:48 am
Code:
  while(Serial.available() == 0);
  {
  byte data1 = Serial.read() - '0';

  int pos1 = map(data1, 0, 9, 0, 180);
  pos1 = constrain(pos1, 0, 180);
  myservo1.write(pos1);
  }
  {
  byte data2 = Serial.read() - '0';
The curly braces look stupid when they are not needed.

Wait until there is at least one byte to read. Then, read 2 bytes. Nope.
2  Using Arduino / Programming Questions / Re: Interacting with my sketch via a web page on: Today at 04:32:21 am
Quote
PaulS what do you mean exactly by this:
I mean that if the browser makes a GET request like GET / HTTP1.1, you should return the main page. If the browser then makes a GET request like GET /favicon.ico HTTP1.1, you should NOT return the main page. If the browser makes a GET request like GET /?Temp=37&LED7=on HTTP 1.1, the response should indicate that the temperature set point was changed and the LED on pin 7 is now on.
3  Using Arduino / Programming Questions / Re: Setup average sound volume on: Today at 04:25:13 am
Quote
What I would like is the Arduino to make an average for let's say 10 seconds.
So, what is the problem? A while loop to spin for 10 seconds is trivial.

Quote
then it will start sweep for at least 1 minute or so. It won't stop in the moment the noise stops.
Same question; different interval.
4  Using Arduino / Programming Questions / Re: got compile error with SoftwareSerial.h on: Today at 04:20:09 am
The DUE has 4 hardware serial ports. Why are you using SoftwareSerial at all?
5  Using Arduino / Networking, Protocols, and Devices / Re: WI-FI SHIELD AND ARDUINO on: Today at 03:56:43 am
Quote
so , the question is how can we get that button on the web page (IP ADDRESS)
On what page? Is the Arduino a server or a client?

Quote
after clicking it how the data would be send from web to arduino board
As another GET request. You are printing the GET requests, aren't you?

Quote
the thing is my project in which i am working on is to control home appliances using Web Through Wi-Fi
Sounds like homework for someone who has never gotten two computers to talk to each other. This is NOT a beginner project.
6  Using Arduino / Networking, Protocols, and Devices / Re: Arduino UNO + Ethernet Shield + RC522 connexion failed to Xampp server on: Today at 03:53:56 am
Code:
char server[] = "http://localhost/dir1/";
The name localhost means that the server is running on the machine that the client is running on. Clearly, that is NOT the case for you. You MUST supply the actual IP address of the server or the actual name of the server.
7  Using Arduino / Programming Questions / Re: Interacting with my sketch via a web page on: September 01, 2014, 06:46:26 pm
Quote
Without rewriting my sketch can I reset parameters externally, ie on the local Web page, to overwrite, or at least ignore, my initial parameters.
Of course not.

You CAN have the Arduino read the GET requests that the browser makes, and NOT return the same page every time. Instead, return a page, after taking action, based on what the browser asked for.
8  Using Arduino / Programming Questions / Re: Variable losing value, possible overflow ? on: September 01, 2014, 06:43:50 pm
Quote
it does :
Sorry. I missed that. But, I don't see the purpose of this:
Code:
if(gps.encode(ch))
{
Serial.print("sentence complete : ");
Serial.println(gpsSentence);
}
The calling function has NO idea whether the Arduino received a complete sentence. It can NOT read the Serial Monitor.
9  Using Arduino / Programming Questions / Re: Variable losing value, possible overflow ? on: September 01, 2014, 04:15:26 pm
Quote
because if I don't (like in the code below),
which doesn't use gps.encode(). Why not?
10  Using Arduino / Programming Questions / Re: Variable losing value, possible overflow ? on: September 01, 2014, 02:27:36 pm
Code:
gps.encode(ch);
gps.encode() returns true (the sentence is complete) or false (the sentence is not complete). Why are you ignoring the return value?

Code:
for (unsigned long start = millis(); millis() - start < 1000;)
{
Reading GPS data for one second is silly. The GPS does not output a continuous stream of data. It outputs bursts of data periodically. You should read and store all available data, then parse the data when you get a complete sentence.

Code:
readGps();

lcd.clear();
lcd.print(selectedMode);
lcd.print("-");
lcd.print(gpsSerial.overflow());
lcd.print("-");
switch (selectedMode) {
case 0:
LcdOn();
displayPosition();
The readGps() function should return true (got data) or false (no complete sentence). The displayPosition() function should NOT be called until there IS good data to parse and display.
11  Using Arduino / Programming Questions / Re: GLCD Font Format help. on: September 01, 2014, 12:54:05 pm
Convert the hex values to binary. 0x06 = 0b001100. Now look at the picture. Compare the black and white squares in the top row to the 0 and 1 pattern. See a relationship?
12  Using Arduino / Programming Questions / Re: Help needed with mp3 triggers on: September 01, 2014, 12:51:20 pm
Code:
if(analogPin==1)
What type of variable is this? It suggests that it is a pin number not a value read from a pin.

Code:
         if (activePad[pad])
Again, no context, so it isn't clear that acrivePad is an array.

Code:
           MP3player.playTrack([i]);
Why is i inside square brackets?

Quote
262: error: expected unqualified-id before 'if'
And, we are left to guess which line is line 262. No thanks.
13  Using Arduino / Programming Questions / Re: Help needed with mp3 triggers on: September 01, 2014, 11:07:54 am
Quote
but nothing works, or even complies at this point.
If the code you have does not compile, and you do not understand why not, it is not useful to just post that complaint here. Post your code and your error messages.

Quote
I've been looking at the SPFMP3-Player-Shield-Library.
The one on sale this week at WalMart?
14  Using Arduino / Programming Questions / Re: sending serial data to 3G module on: September 01, 2014, 11:02:35 am
Quote
Now how to remove it?
The easiest way is to not put it there in the first place.

Code:
          while(character != '\n' && character != '\r')
          {
            if(isdigit(character))
            {
              value.concat(character);
            }
            else if(character != '\n' && character != '\r')
            {
              valid = false;                                     // Use of invalid values
            }
            character = myFile.read();           
          };
15  Using Arduino / Programming Questions / Re: WS2812 working simultanius on 2 arduino ports with button on: September 01, 2014, 10:20:46 am
This:
Code:
void theaterChase(uint32_t c, uint8_t wait) {
  for (int q=0; q < 3; q++) {
    for (int i=0; i < strip_a.numPixels(); i=i+3) {
      strip_a.setPixelColor(i+q, c);
    }  //zet elke 3de RGD LED aan
    strip_a.setBrightness(75);
    strip_a.show();
    delay(200);                      // tijd dat de led aan blijft en daarna door onderstaande code wordt uitgeschakeld
    for (int i=0; i < strip_a.numPixels(); i=i+3) {
      strip_a.setPixelColor(i+q, 0);     //zet elke 3de RGB LED uit
      strip_a.Color(0, 0, 0);
      strip_a.show();
    }
  }
}
is a blocking function. When you call this function, the Arduino does nothing else until this function ends. You can's have two different versions of this function, for the two light strips, running simultaneously.

You need to read, understand, and embrace the blink without delay example's philosophy, and read up on state machines.

On any given pass through loop(), you decide whether it is time to change state (what a given strip is showing), and if so, what the new state should be. Then, if it is time to change state, you record when the state changed, and implement the state change.

Do the same for the other strip.
Pages: [1] 2 3 ... 3291