Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(Solved) problem with "sin" function on 8-bit pinguino
03-01-2012, 11:44 AM,
#11
RE: problem with "sin" function on 8-bit pinguino
Are you still using b9.05 ?
I get no issues with the last revision of Pinguino ...
Of course I deleted these lines :
#define PIC18F4550
#include <math.h>


(03-01-2012, 01:49 AM)micro_cadaver Wrote: Bad news Undecided

Still not working, I made the changes done by regis but the compiler outpus this error again:

Code:
Error mientras enlazaC:\PICs\Pinguino\CursoPinguino\Project_7.o

Code:
// Project 7 - Pulsating lamp
//no compila la funcion "sin"!!!!!!!!!!!!!!!!!

#define PIC18F4550
#include <math.h>
//#include <float.h>

int ledPin = 11;
float sVal;
//float sinfVal;
int ledVal;
float x;

void setup() {
  //pinMode(ledPin, OUTPUT);
}

void loop() {
  for (x=0.0; x<180.0; x++) {
    // convert degrees to radians
    // then obtain sin value
    sVal = sin(x*(3.1412/180.0));
    ledVal = (int)(sVal*255.0);
    analogWrite(ledPin, ledVal);
    delay(25);
  }
}

It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
03-01-2012, 09:21 PM,
#12
RE: problem with "sin" function on 8-bit pinguino
Hi Regis,

I'm on it, but the windows 7 of my laptop has a conflict with pinguino x.2. I'm going to follow your advice and check the log file.
mi Blog MicroEmbebidos (PINGUINO,PIC,STM32F,ATMEL)
http://microembebidos.wordpress.com/
Reply
05-01-2012, 04:18 AM,
#13
RE: problem with "sin" function on 8-bit pinguino
ya funciona hermanos!!!!

Today I could install x.2 and the codes compiles (47% used jojooj), but I noted one interesting "bug?":

this codes outputs error:
Code:
Board:    Generic 18F4550
Proc:     18f4550
C:\pinguinobetax2\source\/user.c:31: error 101: too many parameters
error while compiling file C:\PICs\Pinguino\CursoPinguino\Project_7
Code:
// Project 7 - Pulsating lamp
//no compila la funcion "sin"!!!!!!!!!!!!!!!!!

//#define PIC18F4550
//#include <math.h>
//#include <float.h>

int ledPin = 11;
float sVal;
//float sinfVal;
int ledVal;
float x;

void setup() {
  //pinMode(ledPin, OUTPUT);
}

void loop() {
  for (x=0.0; x<180.0; x++) {
    // convert degrees to radians
    // then obtain sin value
    sVal = sin(x*(3.1412/180.0));
    ledVal = (int)(sVal*255.0);
    analogWrite(ledPin, ledVal);
    delay(25);
  }
}

but these works ok:
Code:
int ledVal, ledPin = 11;
float sVal, x;

void setup() {
  //pinMode(ledPin, OUTPUT);
}

void loop() {
  for (x=0.0; x<180.0; x++) {
    // convert degrees to radians
    // then obtain sin value
    sVal = sin(x*(3.1412/180.0));
    ledVal = (int)(sVal*255.0);
    analogWrite(ledPin, ledVal);
    delay(25);
  }
}

why? the only difference is these lines:
Code:
//#define PIC18F4550
//#include <math.h>
//#include <float.h>

But check it out!, even though they are already commented, the compiler processed it.

Interesting no? But the code works jejejej!!!! Now I can continuing migrating arduino examples to pinguino.

Have a nice day and saludenme a la familia pinguino!!!!
mi Blog MicroEmbebidos (PINGUINO,PIC,STM32F,ATMEL)
http://microembebidos.wordpress.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)