Recent Posts

Pages: 1 ... 8 9 [10]
91
I looked up the IP in the log and it appears to be some Chinese scanning.

General IP Information



IP:
125.64.35.67

Decimal:
2101355331

Hostname:
125.64.35.67

ISP:
China Telecom Sichuan

Organization:
China Telecom SiChuan Telecom Internet Data Center

Services:
None detected

Type:
Broadband

Assignment:
Static IP
92
It has to change sometime, right? And therefore it might be one microsecond at one temperature, and then a microsecond later it will be a different temperature.
At the change, it will always be at one temperature, and then a microsecond later it will be a different temperature, but the likelihood of that change occurring between his two reads is mighty slim. I'll concede that I was a little too pessimistic with "will never be true." "Will almost never be true" would be more accurate.
93
Sensors / Re: Putting GPS and Compass on...
Last post by project science - Today at 04:42 am
Well, I did calibrate it, and changed some things around. Compass reads +/- 3 degs of raw hand compass reading at each of the poles now.

I took 3 sample GPS points around me with line of sight, and pointed the compass directly at each one.  Off of True North, I used 88 degs, 136 degs, 257 degs.  So basically 3 points, spaced out around a circle.

I noticed that for each of these, the compass reading was +45 degs more than the calculated GPS reading. 

I'm wondering if I should just scaled the compass reading -45 degrees in my code.  I don't really know why it is off, but if it's a constant error, it seems to make sense.

Thoughts?
94
Where did you get that code from? I can't find code by Nick Gammon that has a processNumbers function in it. That is where the problem lies. If you input <13.003>, the code calls processNumbers(13,3) which then prints 13.3 because there's no information there about how many zeros are before the '3'.
i.e. entering <13.3> <13.03> <13.003> etc. will all print 13.3

Pete
I put that function in trying to read decimals.... I know why it isn't working... I just don't know how to fix it lol...
95
Programming Questions / Re: DS3231 days since date
Last post by David-P - Today at 04:39 am
Just use time_t variables (be sure to include the Time library) and subtract them. That will give the number of seconds between the two times. Divide by 86400 seconds per day and that gives the days between the two. That's about as simple as it gets :smiley-grin:
There we go! Thank you :) this pointed me in the right direction and it's perfect.
96
Are you trying to print floating point numbers,   to two separate integers ?

That second piece of code you posted,  is code to help you debug the first piece of code,  which is code for converting incoming numbers,  expressed as ascii text, into actual numbers.    That second piece of code you posted,   is not a useful method of outputting numbers in any useful context.

You need to be aware that there are some shortcomings in the arduino concerning printing floating point numbers,   and methods that you use in other languages and platforms may have unexpected defective results.
97
I do not wish to offend, but I view the Arduino more of a toy platform - albeit a rather capable toy.

Ray

I spent years writing and fixing software that small businesses ran on less capable toys with.

But when what you know are desktop supercomputers, it's like comparing the latest Airbus to a sedan.
I don't need an Airbus to go get groceries.
98
It would change even quicker if he just turned the heater on. :)
I see that this is turning into a hot topic.  ;D
99
Microcontrollers / Re: How to sum up all the valu...
Last post by aspirines - Today at 04:35 am
but then using I2C, i got problem.

seems i can't pass the bufs value of from loop() to void requestEvent() to pass it to master using Wire.h.
Code: [Select]
void loop()
{
  if(s=='H')
  {
     myFile = SD.open("test.txt");
    if (myFile) {
      Serial.println("test.txt:");
      while (myFile.available()) {
        S1 = myFile.parseInt();
        a=a+S1-0;
      }
        Serial.print(a); //it can display the total sum of test.txt value.
      myFile.close();
    }
    sprintf(bufs,"sum:%lu",a); //the value of bufs will be pass for I2C com. but i can't get it.
  }
  a='\0';
 delay(5000);
}

 

Code: [Select]
void requestEvent()
{
  Wire.write(bufs);
}




#include <Wire.h>
#include <SPI.h>
#include <SD.h>
int S1;
char i;
int a=0;
void setup()
{
Wire.begin(5);
Wire.onReceive(receiveEvent);
  Wire.onRequest(requestEvent);
while (!Serial) {
    ;
  }
  Serial.print("Initializing SD card...");
  pinMode(10, OUTPUT);
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
  randomSeed(analogRead(0));
  lcd.print("Initialization done");
  delay(2000);
}
void loop()
{
  if(s=='H')    //from void receiveEvent(int howMany)
  {
     myFile = SD.open("test.txt");
    if (myFile) {
      Serial.println("test.txt:");
      while (myFile.available()) {
        S1 = myFile.parseInt();
        a=a+S1-0;
        Serial.print(S1);
      }
        Serial.print(a);
      myFile.close();
    }
    sprintf(bufs,"sum:%lu",a);
   
  }
  a='\0';
 delay(5000);
}
void receiveEvent(int howMany)
{
  while(Wire.available() > 0)
  {
    char c = Wire.read();
    numbers[i++] = c;
    numbers='\0';
  }
 if (strcmp (numbers,"A")==0) {
    {
    s='H';     //pass to void loop()
    }
}
void requestEvent()
{
  Wire.write(bufs);     // i can't get the bufs value from void loop().
}
it can display the total sum from test.txt file after summing up to Serial monitor but i need to get the value and display to master.
i can't pass the value from slave to master.
100
Sensors / Re: Incremental Rotary Encode...
Last post by michinyon - Today at 04:34 am
If you are using unsigned 16 bit integers,  then -1 is the same as 65535.   If this is going to be a problem for you,   then use signed integers.
Pages: 1 ... 8 9 [10]