Show Posts
Pages: 1 [2] 3 4 ... 1898
16  Using Arduino / Programming Questions / Re: Push button timer and LCD readout sketch needed on: Today at 05:31:25 am
Quote
Not everyone can rebuild an automatic transmission.  They may, if they are lucky, able to change the oil and maybe adjust a band it thats an option, but, to pull all the bolts out to remove it, pull the front pump ass and replace the clutch plates and seals? 
Strange analogy.

I've never owned a vehicle with automatic transmission, so my opportunities to dismantle, let alone rebuild, one have been severely restricted (my choice).
However, I am aware of the existence of professionals who will, for a financial consideration, perform the required operations for me.
There are also others who will, if I show willing and/or another financial consideration, teach me how to perform the required operations for myself.

(My silence on this thread so far has been due to ignorance of the existence of the thread, until it was reported)
17  Using Arduino / General Electronics / Re: The important of calibration of oscilloscopes. Or not? on: Today at 03:05:58 am
My desk scope is clearly labelled "For indication only", but lab bench scopes are calibrated annually.
18  Using Arduino / Programming Questions / Re: print in serial the name of the file\program? on: Today at 02:31:16 am
good to know the standard "macros" that exist within gcc - the _F() is just to place the string in program memory (save memory)

https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
sp. "the F() is just to leave the string in program memory (save RAM)"
19  Using Arduino / Programming Questions / Re: How to convert Char* to float? on: Today at 02:09:00 am
Quote
As the post topic mention I'm trying to convert char* to  float.
On an eight bit Arduino, a "char*" is two bytes and a "float" is four.
Your question doesn't make a lot of sense.

If you're saying you've taken the address of a "float" and cast that address to a "char*" instead of the more natural "float*", then recovering the original "float" is trivial.
20  Using Arduino / Programming Questions / Re: Code for scrolling text by using max7219 to drive a 8x8 led matrix on: Today at 02:04:44 am
anyone pls help me..during compilation an error may occur 1."byte" does not name a type 2.byte has not been declared 3.boolean has not been declared...............am also impoted the arduino library.led control.h
Make sure you've included "Arduino.h".
Please don't hijack threads.
21  Using Arduino / Programming Questions / Re: print in serial the name of the file\program? on: Today at 01:45:07 am
Code:
Serial.println(F(__FILE__));
22  Using Arduino / Project Guidance / Re: Start/stop a Loop on: Today at 01:42:24 am
Quote
the interesting thing is that it worked
sp. "the interesting thing is that it appeared to work"
23  Using Arduino / Programming Questions / Re: const int and memory space on: September 01, 2014, 02:18:57 pm
Code:
const int variable = 253;
const int other = 13;

const char constChar = 124;
const char otherChar = 7;
char variable1 = 23;
char variable2 = 24;
int a;
int b;

int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

#define PRINT_VAL(x) {Serial.print (F(#x)); \
                      Serial.print (F(" = ")); \
                      printVal ((const char*)&x); }

void setup()
{
  a = variable;
  b = other;
  Serial.begin(115200);
 
  Serial.print (F("freeRam  "));
  Serial.println(freeRam());
  Serial.print (F("a "));
  Serial.println(a);
  Serial.print (F("b  "));
  Serial.println(b);
  PRINT_VAL (constChar);
  PRINT_VAL (otherChar);
  PRINT_VAL (variable1);
  PRINT_VAL (variable2);
}

void loop()
{}

void printVal (const char* x)
{
  Serial.print ((int)*x);
  Serial.print (F(" @ "));
  Serial.println ((int)x);
}
The point here is that
Quote
So, my conclusion is that the variables const int are  not placed in the the data space memory.
is incorrect.
If there are no indirect references to the "const" then the compiler is free to optimise them away (usually as an immediate constant in the assembler), but if any indirect reference exists, then the compiler is usually obliged to place the "const" into RAM.
24  Using Arduino / Programming Questions / Re: changing values over serial monitor on: September 01, 2014, 01:36:18 pm
Very basic, uncompiled & untested
Code:
  static int threshold = 35;
  if (Serial.available ())
  {
    static int newThreshold;
    int inChar = Serial.read ();
    if (isdigit (inChar))
    {
      newThreshold *= 10;
      newThreshold += inChar - '0';
    }
    if (inChar == '\n')
    {
      threshold = newThreshold;
      newThreshold = 0;
   }   
  }
  if (celsius < threshold) {
 
25  Using Arduino / Programming Questions / Re: changing values over serial monitor on: September 01, 2014, 01:20:28 pm
You can't have executable code outside of a function, in this case you're missing "loop()".

Also "relay" is not the same as "realy", and you're going to forget that stray "7" sooner or later, so fix that now too.

Also, "didital" != "digital"

(uncompiled, untested)
Code:
const byte  sensorPin = A0;
const byte  relay =7;

void setup()
{
  pinMode(relay, OUTPUT);
  Serial.begin(9600);
}

void loop ()
{
  int reading = analogRead(sensorPin);
  int celsius = reading/2;

  if (celsius < 35) {
    digitalWrite(relay, HIGH);
  } else{
    digitalWrite(relay,LOW);
  }
  delay(500);
}
26  Using Arduino / Programming Questions / Re: How to put 4 digital inputs in to a byte on: September 01, 2014, 12:08:58 pm
Quote
I have read the bitwrite and bitread commands but I do not totally understand them.
I'd persist with bitWrite a while longer
27  Community / Exhibition / Gallery / Re: morse code on: September 01, 2014, 09:28:22 am
A very simple way to make your code a whole lot shorter and easier to modify
Code:
void writeDot ()
{
  digitalWrite(zil , HIGH);
  delay(150);
  digitalWrite(zil , LOW);
  delay(100);
}

void writeDash ()
{
  digitalWrite(zil , HIGH);
  delay(450);
  digitalWrite(zil , LOW);
  delay(100);
}

(there are other ways)
28  Using Arduino / Project Guidance / MOVED: morse code on: September 01, 2014, 09:23:02 am
This topic has been moved to Exhibition / Gallery.

http://forum.arduino.cc/index.php?topic=264349.0
29  Using Arduino / Programming Questions / Re: const int and memory space on: September 01, 2014, 09:07:30 am
Quote
So, my conclusion is that the variables const int are  not placed in the the data space memory.

Is my conclusion right?
I think from your very limited testing, yes, that's correct.

Consider:
Code:
const int variable = 256;
const int other = 16;

const char constChar = 124;
const char otherChar = 7;

int a;
int b;

int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

void setup() {
  a = variable;
  b = other;
  Serial.begin(115200);
  
  Serial.println(freeRam());
  Serial.println();
  Serial.println(a);
  Serial.println(b);
  printVal (&constChar);
}

void loop() {
}

void printVal (const char* x)
{
  Serial.println ((int)*x, HEX);
}

And now?

Edited to correct code. (added two declarations missed when cut and pasted))
30  Using Arduino / Programming Questions / Re: 1024hz to milliseconds on: September 01, 2014, 08:09:26 am
I read it as "I want to be able to timestamp to (roughly) millisecond accuracy"
Pages: 1 [2] 3 4 ... 1898