Jump to content

hariz

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. @StefanSch If this " #include<SoftwareSerial.h> " cannot be use, what command i need to use? Can you tell what i need to do?
  2. @NurseBob currently i want to use 16Mhz entries. Do i need to change the program code or change the connection in board? Futhermore, can you teach me to make the programmed work? Hope you can assist me.
  3. Hello, I have been working with the MSP4305229 Launchpad and have been trying to work with Bluetooth. I'm using HC-06 module. Currently use energia to programmed the code. During the compiling, it produce the error code. I have been trying use others code and still produce the same error. Do you have any ideas to solve the error? Kindly seek your assistance. Thank you. Here the message of error. Energia: 1.8.7E21 (Windows 10), Board: "MSP-EXP430F5529LP" C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp:81:2: error: #error This version of SoftwareSerial supports only 16MHz processors C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)': C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp:251:31: error: 'table' was not declared in this scope C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual size_t SoftwareSerial::write(uint8_t)': C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp:319:26: error: 'XMIT_START_ADJUSTMENT' was not declared in this scope exit status 1 Error compiling for board MSP-EXP430F5529LP. This is the coding. // define TROUBLESHOOT #include <SoftwareSerial.h> SoftwareSerial bluetooth(P3_4, P3_3); // RX, TX int i; int j; int min; int max; float rms; float totalF; float a0; float a1; float b1; float a2; float b2; float a3; float b3; float a4; float b4; float a5; float b5; float a6; float b6; float rmsac; float h1; float h2; float h3; float h4; float h5; float h6; float thd; float total; float multiply=1.459; uint16_t adc[180]; float timer; char data=0; void setup() { Serial.begin (9600); bluetooth.begin(9600); //bluetooth } void loop() { i=0; timer=millis(); while(millis()-timer < 20) //Get sample ADC in 20ms { adc=analogRead(A0); i++; } j=0; min=1023; max=0; total=0; #if defined (TROUBLESHOOT) Serial.println(i); #endif for(j=0;j<i;j++) { #if defined (TROUBLESHOOT) Serial.println(adc[j]); #endif if(adc[j]>max) max=adc[j]; if(adc[j]<min) min=adc[j]; total+=adc[j]*adc[j]; } total=total/i; rms=sqrt(total); total=0; for(j=0;j<i;j++) { total+=adc[j]; } a0=(float)total/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*cos(2*PI*j/i); } a1=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*sin(2*PI*j/i); } b1=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*cos(2*2*PI*j/i); } a2=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*sin(2*2*PI*j/i); } b2=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*cos(2*3*PI*j/i); } a3=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*sin(2*3*PI*j/i); } b3=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*cos(2*4*PI*j/i); } a4=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*sin(2*4*PI*j/i); } b4=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*cos(2*5*PI*j/i); } a5=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*sin(2*5*PI*j/i); } b5=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*cos(2*6*PI*j/i); } a6=(float)2*totalF/i; totalF=0; for(j=0;j<i;j++) { totalF+=adc[j]*sin(2*6*PI*j/i); } b6=(float)2*totalF/i; rmsac=sqrt(rms*rms-a0*a0); h1=sqrt((a1*a1+b1*b1)/2); h2=sqrt((a2*a2+b2*b2)/2); h3=sqrt((a3*a3+b3*b3)/2); h4=sqrt((a4*a4+b4*b4)/2); h5=sqrt((a5*a5+b5*b5)/2); h6=sqrt((a6*a6+b6*b6)/2); thd=100*sqrt(rmsac*rmsac-h1*h1)/h1; #if defined (TROUBLESHOOT) Serial.println("MIN="+String(min)); Serial.println("MAX="+String(max)); Serial.println("RMS="+String(rms)); Serial.println("A0="+String(a0)); Serial.println("A1="+String(a1)); Serial.println("B1="+String(b1)); Serial.println("A2="+String(a2)); Serial.println("B2="+String(b2)); Serial.println("A3="+String(a3)); Serial.println("B3="+String(b3)); Serial.println("A4="+String(a4)); Serial.println("B4="+String(b4)); Serial.println("A5="+String(a5)); Serial.println("B5="+String(b5)); Serial.println("A6="+String(a6)); Serial.println("B6="+String(b6)); Serial.println("H1="+String(h1)); Serial.println("H2="+String(h2)); Serial.println("H3="+String(h3)); Serial.println("H4="+String(h4)); Serial.println("H5="+String(h5)); Serial.println("H6="+String(h6)); Serial.println(); #else Serial.print("RMS:"+String(multiply*rmsac)+","); Serial.print("H1:"+String(multiply*h1)+","); Serial.print("H2:"+String(multiply*h2)+","); Serial.print("H3:"+String(multiply*h3)+","); Serial.print("H4:"+String(multiply*h4)+","); Serial.print("H5:"+String(multiply*h5)+","); Serial.print("H6:"+String(multiply*h6)+","); Serial.print("THD:"+String(thd)+";"); Serial.println(); if(data=='C') { bluetooth.print("RMS:"+String(multiply*rmsac)+"A"); bluetooth.print("THD:"+String(thd)+"B"); bluetooth.print("H1:"+String(multiply*h1)+"C"); bluetooth.print("H2:"+String(multiply*h2)+"E"); bluetooth.print("H3:"+String(multiply*h3)+"F"); bluetooth.print("H4:"+String(multiply*h4)+"G"); bluetooth.print("H5:"+String(multiply*h5)+"I"); bluetooth.print("H6:"+String(multiply*h6)+"J"); } #endif if(bluetooth.available()) { data=bluetooth.read(); } delay (1000); }
×