Jump to content

Search the Community

Showing results for tags 'energia'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 498 results

  1. Hello, Is it possible to use the XDS110 debug probe with Energia? And if so, how? Best regards, -C.
  2. Hi everyone I am beginner and I want to use the adxl345 with msp430g2553 with I2C, but the example that I am using don´t working, always send 0 in the axes x,y and z. I use energia 1.6.10e18, the circuit have the pull'up resistor in SDA and SCL pines, and I remove the jumper of the green led. I used the same code but with arduino and it working but with enegia not, help me please. My launchpad is MSP-EXP430G2 rev 1.5 The SCL is connected in pin 14 and the SDA in pin 15. My OS is windows 7 When i put this function "Wire.setModule(0)" the mcu does make nothing, the uart don´t send nothing. The code is the follow: #include <Wire.h> void setup() { Serial.begin(9600); Serial.print("Iniciado"); Wire.begin(); writeTo(DATA_FORMAT, 0x01); //Put the ADXL345 into +/- 4G range by writing the value 0x01 to the DATA_FORMAT register. writeTo(POWER_CTL, 0x08); //Put the ADXL345 into Measurement Mode by writing 0x08 to the POWER_CTL register. } void loop() { uint8_t howManyBytesToRead = 6; readFrom( DATAX0, howManyBytesToRead, _buff); //read the acceleration data from the ADXL345 int X = (((int)_buff[1]) << 😎 | _buff[0]; int Y = (((int)_buff[3]) << 😎 | _buff[2]; int Z = (((int)_buff[5]) << 😎 | _buff[4]; Serial.print("x: "); Serial.print( X ); Serial.print(" y: "); Serial.print( Y ); delay(500); } void writeTo(byte address, byte val) { Wire.beginTransmission(DEVICE); // start transmission to device Wire.write(address); // send register address Wire.write(val); // send value to write Wire.endTransmission(); // end transmission } void readFrom(byte address, int num, byte _buff[]) { Wire.beginTransmission(DEVICE); // start transmission to device Wire.write(address); // sends address to read from Wire.endTransmission(); // end transmission Wire.beginTransmission(DEVICE); // start transmission to device Wire.requestFrom(DEVICE, num); // request 6 bytes from device int i = 0; while(Wire.available()) // device may send less than requested (abnormal) { digitalWrite(RED_LED,HIGH); _buff = Wire.read(); // receive a byte i++; } Wire.endTransmission(); // end transmission }
  3. ironoman

    Energia Support MSP430FR6972

    I am trying to add MSP430FR6972 in Energia. So far i have edited board.txt , board.mk but the pin_energia.h seems alot complicated than the previous two. So i need some help in doing so. I think the way i am adding a new board in energia might be wrong so just point me in the right direction and i will do the rest.
  4. Hello, I want CC3200 to act as an access point and server a webpage to give SSID and Password of a router. For this I am using SmartConfigexample in Energia. When I upload the code then it only shows " Starting WiFi SmartConfig" on Serial monitor. No AP appears. Is there something I might be missing? What should be the jumper setting while running this application on CC3200? Is there any relevant tutorial available for this example?
  5. Hello, I'm really struggeling to implement the TI instaspin FOC for a C2000 TMS320F28027F launchpad, as a stand alone deployment in an embedden system. I was wondering if it is possible to do this with Energia? kind regards Joppe Baalhuis
  6. hai, am working energia at CC3220SF i need to Muti UART Communication , need to Software Serial header File GPIO or Digital Pin it possible to connect UART communication any other Example for Multiuart code at CC3220SF or CC3200 how many UART is possible to connect at CC3220SF THANKS SELVA
  7. Hello everyone! I am using the SIM800L module to send SMS through a TivaC TM4C123GXL board, but its clock is 80MHz, and the library only accepts 20, 16 or 8 MHz. In Arduino it worked perfectly, this code found on a website. How do I reduce the TM4C123 clock in Power software? Is there another solution? Thanks in advance! The code: #include <SoftwareSerial.h> SoftwareSerial sim(3, 4); int _timeout; String _buffer; String number = ""; //here I inserted my number phone void setup() { delay(4000); //delay for 7 seconds to make sure the modules get the signal Serial.begin(9600); _buffer.reserve(50); Serial.println("Sistem Started..."); sim.begin(9600); delay(1000); } void loop() { SendMessage(); delay(10000); } void SendMessage() { //Serial.println ("Sending Message"); sim.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode delay(1000); //Serial.println ("Set SMS Number"); sim.println("AT+CMGS=\"" + number + "\"\r"); //Mobile phone number to send message delay(1000); String SMS = "Testing GSM module"; sim.println(SMS); delay(100); sim.println((char)26);// ASCII code of CTRL+Z delay(1000); _buffer = _readSerial(); } String _readSerial() { _timeout = 0; while (!sim.available() && _timeout < 12000 ) { delay(13); _timeout++; } if (sim.available()) { return sim.readString(); } } The error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
  8. I get the error "'SPISettings' does not name a type" when I compile my code for LoRaWAN. The codes are working in Arduino with the libraries LoRa.h and SPI.h. I have added the image to where the error is pointing at (In LoRa Library) and the Error message as well below. I tried changing the energia SPI library to the Arduino SPI library as well but this created more problems. Out of all the things I tried, the most simple error I get is here when it says "Does not name a type". How can I correct that bit of code to get rid of this error. I'm a relative beginner in Energia and not sure what to do. Appreciate any help. Thank you🙂
  9. neznaika

    MSP432 Hardware UART(2)(3)

    Hello, I could not find complete answer so posting this question. Is it possible to use MSP432 hardware serial (2..3) in Energia? Is there any specific reason it is not implemented or special syntax has to be used? Thanks in advance
  10. In the standard Button example in Energia (Examples->02.Digital->Button), it works fine when I upload it to the MSP432P401R. But if I add a delay to the loop that is greater than 250ms, then the LED that's supposed to turn back on when the button is released, never turns back on. If the delay is less than 250ms, then the sketch works as expected. Why do you think this happens? const int buttonPin = PUSH2; // the number of the pushbutton pin const int ledPin = GREEN_LED; // the number of the LED pin // variables will change: int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT_PULLUP); } void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } delay(500); //BUG: when this is here, then the LED never turns back on }
  11. I cannot get this led to dim. It will flash on and off but no PWM as far as I can see. I copied the code right from the website here. http://energia.nu/Tutorial_Fading.html and wired everything the way it should be. Using a 220Ohm resistor instead of the 10k they had in there BOM. What am I doing wrong? I am using the MSP430G2231 chip and have all my settings in energia set accordingly I really don't know what I am doing wrong or if I have a faulty chip? Looking for someone to point me in the right direction.
  12. Hi, Is there anyway I can convert specific Arduino Libraries to Energia? I am using lora.h github library in Arduino, but now I want to use it on Energia. How can I modify this library to support my msp430g2553 device on Energia? Thank you.
  13. Hey guys, I´m using TM4C123G but I can´t configure Energia. When I go in board management and try downloading Energai TivaC Boards it fails and an error messaging appears saying "error during download..." Anyone knows how can I sovle it? Regards!
  14. Hallo, I have ordered the MSP-EXP430FR2433 from TI. While I am waiting I have installed the MSP-EXP430FR2433 board. I opened the ASCIITable .ino in Energia and clicked the V button. I get the following errors: Energia: 1.6.10E18 (Windows XP), Board:"MSP-EXP430FR2433LP" I:\EnergiaIDE\arduino-builder -dump-prefs -logger=machine -hardware "I:\EnergiaIDE\hardware" -hardware "C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages" -tools "I:\EnergiaIDE\tools-builder" -tools "I:\EnergiaIDE\hardware\tools\msp430" -tools "C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages" -built-in-libraries "I:\EnergiaIDE\libraries" -libraries "I:\Energia\libraries" -fqbn=energia:msp430:MSP-EXP430FR2433LP -ide-version=10610 -build-path "C:\DOCUME~1\hmjswt\LOCALS~1\Temp\build955a2213c49034f4193ce8bb7d81a022.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "I:\EnergiaIDE\examples\04.Communication\ASCIITable\ASCIITable.ino" I:\EnergiaIDE\arduino-builder -compile -logger=machine -hardware "I:\EnergiaIDE\hardware" -hardware "C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages" -tools "I:\EnergiaIDE\tools-builder" -tools "I:\EnergiaIDE\hardware\tools\msp430" -tools "C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages" -built-in-libraries "I:\EnergiaIDE\libraries" -libraries "I:\Energia\libraries" -fqbn=energia:msp430:MSP-EXP430FR2433LP -ide-version=10610 -build-path "C:\DOCUME~1\hmjswt\LOCALS~1\Temp\build955a2213c49034f4193ce8bb7d81a022.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "I:\EnergiaIDE\examples\04.Communication\ASCIITable\ASCIITable.ino" Using board 'MSP-EXP430FR2433LP' from platform in folder: C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3 Using core 'msp430' from platform in folder: C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3 Detecting libraries used... "C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\tools\msp430-gcc\4.6.5/bin/msp430-g++" -c -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=msp430fr2433 -DF_CPU=8000000L -DARDUINO=10610 -DENERGIA=10610 -DENERGIA_MSP_EXP430FR2433LP -DENERGIA_ARCH_MSP430 -IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\tools\msp430-gcc\4.6.5/include "-IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3\cores\msp430" "-IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3\variants\MSP-EXP430FR2433LP" "C:\DOCUME~1\hmjswt\LOCALS~1\Temp\build955a2213c49034f4193ce8bb7d81a022.tmp\sketch\ASCIITable.ino.cpp" -o "nul" "C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\tools\msp430-gcc\4.6.5/bin/msp430-g++" -c -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=msp430fr2433 -DF_CPU=8000000L -DARDUINO=10610 -DENERGIA=10610 -DENERGIA_MSP_EXP430FR2433LP -DENERGIA_ARCH_MSP430 -IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\tools\msp430-gcc\4.6.5/include "-IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3\cores\msp430" "-IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3\variants\MSP-EXP430FR2433LP" "C:\DOCUME~1\hmjswt\LOCALS~1\Temp\build955a2213c49034f4193ce8bb7d81a022.tmp\sketch\ASCIITable.ino.cpp" -o "nul" Generating function prototypes... "C:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\tools\msp430-gcc\4.6.5/bin/msp430-g++" -c -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=msp430fr2433 -DF_CPU=8000000L -DARDUINO=10610 -DENERGIA=10610 -DENERGIA_MSP_EXP430FR2433LP -DENERGIA_ARCH_MSP430 -IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\tools\msp430-gcc\4.6.5/include "-IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3\cores\msp430" "-IC:\Documents and Settings\hmjswt\Local Settings\Application Data\Energia15\packages\energia\hardware\msp430\1.0.3\variants\MSP-EXP430FR2433LP" "C:\DOCUME~1\hmjswt\LOCALS~1\Temp\build955a2213c49034f4193ce8bb7d81a022.tmp\sketch\ASCIITable.ino.cpp" -o "C:\DOCUME~1\hmjswt\LOCALS~1\Temp\build955a2213c49034f4193ce8bb7d81a022.tmp\preproc\ctags_target_for_gcc_minus_e.cpp" msp430-g++: error: and: No such file or directory msp430-g++: error: Settings\hmjswt\Local: No such file or directory msp430-g++: error: Settings\Application: No such file or directory msp430-g++: error: Data\Energia15\packages\energia\tools\msp430-gcc\4.6.5/include: No such file or directory exit status 1 Fout bij het compileren van board MSP-EXP430FR2433LP Any help? Thank you, Henk Siewert
  15. Hello, I have MSP430FR6989 Launchpad. As per below schematic,I generate internal Vref+ voltage 1.2V on Pin P1.1. I'm successfully measure 1.19V on pin P1.1. So,This Vref I apply in NTC as per below schematic( please ignore MSP430FR4133). But I got an issue in below code: void Vref_ON() { while(REFCTL0 & REFGENBUSY); // If ref generator busy, WAIT REFCTL0 |= REFVSEL_0 + REFON + REFOUT; // Enable internal 1.2V reference while(!(REFCTL0 & REFGENRDY)); // Wait for reference generator // to settle } void Vref_Off() { REFCTL0=1; } void setup() { Vref_ON(); Serial.begin(9600); } void loop() { // int val = analogRead(A11); //**** When comment this portion then on P1.1 Vref+ get voltage (1.19V), uncomment then get voltage 0V **** Serial.println(val); delay(500); } In above code, pin P1.1 I got a 1.19V Vref+ successfully but I got an one issue on above code : Please mention comment in code. I can't understand above issue. Please give me a suggestion for issue. Thank you. Regards, Pratik
  16. Usama

    MSP430 GPS

    Hi, Is there any GPS library for energia that supports MSP430g2553? TinyGPS++ doesn't seem to work. Please help. Thank you.
  17. Hi, When doing offset calibration for pH sensor in Arduino we bring pH 7 to 2.5V as Arduino analog output is 5V. Does that mean when the same is done with msp430g2553 the voltage be adjusted to 1.5V as msp430g2553 analog pins output around 3V only? When I tried adjusting the pot I could only bring it to a minimum of 2.5V with msp430. Does anyone know why? Thanks.
  18. The MSP432P104R SPI mode definitions have opposite polarity as the conventional modes, that is confusing enough. Yet, when I import an Energia project into CCS, the SPI polarities of the modes are reversed. I used tone() built-in function in Energia IDE for MSP432P104R. It had no output. I imported the project into CCS to debug it, the tone() function works under CCS. I am using Energia 1.6.10E18 and did all the updates of the libraries. I am using CCS v8 with all the updates. I also deleted the msp432_MSP-EXP432P401R_core and re-import the project and that did not change anything I could tell.
  19. Hi! Im getting these errors: This is my main code, it just reproduces a tone: Reproductor.ino #include "Nota.h" #include "Imperial_March.h" using namespace std; #include <vector> #include <string> template class std::basic_string<char>; #define DO 261.626 #define RE 293.665 #define MIb 311.127 #define MI 329.628 #define FA 349.228 #define FAs 369.994 #define SOL 391.995 #define SOLs 415.305 #define LA 440.000 #define SIb 466.164 #define SI 493.883 #define DOM 523.251 #define DOMs 554.365 #define REM 587.330 #define MIMb 622.254 #define MIM 659.255 #define FAM 698.456 #define FAMs 739.989 #define SOLM 783.991 const int BUZZER1 = PA_7; const int BUZZER2 = PF_1; float duracion_negra = 1.0; const int NUMERO_NOTAS = 216; void setup() { // initialize the digital pin as an output. pinMode(BUZZER1, OUTPUT); pinMode(BUZZER2, OUTPUT); const float DURANCION_MINIMA = duracion_negra/4.0; Imperial_March cancion; } void loop() { float nota_a_tocar = MI; digitalWrite(BUZZER1, HIGH); // turn the signal to buzzer high digitalWrite(BUZZER2, HIGH); // turn the signal to buzzer high delayMicroseconds( 1/(2*nota_a_tocar) *1000000 ); // wait for half cycle digitalWrite(BUZZER1, LOW); // turn the signal to buzzer low digitalWrite(BUZZER2, LOW); // turn the signal to buzzer low delayMicroseconds( 1/(2*nota_a_tocar) *1000000 ); // wait for half cycle } And the class I created, is just a "song": Imperial_March.cpp #include "Imperial_March.h" #include <iostream> Imperial_March::Imperial_March() { std::string notas_aux[] = {"SOL","SOL","SOL","MIb","SIb","SOL","MIb","SIb","SOL","REM","REM","REM", //12 "MIMb","SIb","FAs","RE","SIb","SOL","SOLM","SOL","SOL","SOLM","FAMs","FAM", //24 "MIM","SOLs","DOMs","DOM","SI","SIb","MIb","FAs","MI","FA","SIb","SOL", //36 "SI","SI","SOLM","SOL","SOL","SOLM","FAMs","FAM","MIM","SOLs","DOMs","DOM", //48 "SI","SIb","MIb","FAs","MI","SI","SOL","MIb","SIb","SOL","SOL","SOL", //60 "SOL","MIb","SIb","SOL","MIb","SIb","SOL","RE","RE","RE","MIMb","SIb", //72 "FAs","RE","SIb","SOL"}; tamanio = sizeof(notas_aux)/sizeof(std::string); unsigned int i = 0; for(i=0; i<tamanio; i++) notas.push_back(notas_aux[i]); } Imperial_March::~Imperial_March(){} std::string Imperial_March::Get_nota(int pos){ return notas[pos]; } int Imperial_March::Get_tamanio(){ return tamanio; } namespace std { void __throw_length_error(char const*){} void __throw_logic_error(char const*){} //void ios_base::Init(){} } And its header Imperial_March.h #ifndef IMPERIAL_MARCH_H #define IMPERIAL_MARCH_H #include "Nota.h" #include <string> #include <vector> class Imperial_March { public: Imperial_March(); ~Imperial_March(); std::string Get_nota(int pos); int Get_tamanio(); private: std::vector<std::string> notas; int tamanio; }; #endif // IMPERIAL_MARCH_H
  20. I'm using ccs7.4, import Energia e18, choose blink example, use MSP-FET Flash Emulation Tool to program for IC msp430g2452. The code is working. it blink led. But take about 25second to begin running. I don't know why. i need some help.
  21. Hello my friends, I have a macbookPro with macOS highSierra and I installed the latest version of IDE energy. After that I tried to compile the basic blink example. Following error was returned: ino2cpp: error: sketch directory '{build.project_path}' doesn't exist or isn't a directory. exit status 1 Error compiling for board RED LaunchPad w/ msp432 EMT (48MHz). Can someone help me? I would like to have energia functional.
  22. Hello, I am experiencing a frustrating problem which I couldn't find an answer to anywhere online so far, I apologize if a related question was posted before and I didn't find it. I have TI MSP-EXP430G2 Launchpad with an MSP430G2452 on it and I'm trying to upload a basic program (the Blink example) with Energia. After the program has been successfully uploaded the program is not run immediately on the chip and the led doesn't start blinking. Instead there is a long delay (30sec to a few minutes) between powering the device on and the start of the execution. There don't seem to be any errors on compilation/upload. On the other hand, I have tried using Code Composer Studio instead and there the program starts running immediately without any problems. I would really appreciate if anyone has some idea what could be the problem. Thanks in advance.
  23. Hello! I m trying to run the code for the coin acceptor mechanism. its getting compiled properly on but on updation it is showing no output on serial monitor i.e serial monitor is completely blank. Since i m using Energia IDE for TM4C123gxl so i have tried the same code on Arduino IDE as well and over there it is giving the exact output as i want. and all the things are correctly selected ie the port, board and everything. What could be the problem? Code.txt
  24. Ssherry

    cc3100

    I am working on code related to sending an email through cc3100booster and msp432p401r. I am having an issue in connectivity of wifi in the module when the wifi connection code is provided in void setup(). I am providing mobile's hotspot and it gets connected and disconnected periodically. I require an continuous connection. When the wifi connection code is written inside loop(), the connection problem is solved but a newer issue is arised i,e, the program is running for email but not for the server [In server program i am sending temperature and pulse count value to thingspeak.com to get a graphical representation of my data.] moreover, despite of being present in loop, it executes only once. its a complete arcane issue for me. I am linking code below. please help me out with this. #define TEMBOO_ACCOUNT "xxxxxxx" // your Temboo account name #define TEMBOO_APP_KEY_NAME "xxxxxxx" // your Temboo app name #define TEMBOO_APP_KEY "xxxxxxxx" // your Temboo app key #define WIFI_SSID "xxxxxx" //hotspot name #define WIFI_PASSWORD "xxxxxxx" //hotspot password #ifndef __CC3200R1M1RGC__ #include <SPI.h> #include <WiFi.h> #include <WiFiClient.h> #include <Temboo.h> #endif const String GMAIL_USER_NAME = "xxxxxxx"; //sender's email const String GMAIL_APP_PASSWORD = "xxxxxx"; //sender's app password const String TO_EMAIL_ADDRESS = "xxxxxxx"; //receiver's email boolean attempted = false; #include <LiquidCrystal.h> LiquidCrystal lcd(13,33,12,24,5,25,6,26,27,8,28); float temp; float volt; int sensorValue1; int sensorValue2; int count; WiFiClient client; char server[] = "api.thingspeak.com"; unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds void checkconnection() { int wifiStatus = WL_IDLE_STATUS; // determine if the WiFi Shield is present. Serial.print("\n\nShield:"); if (WiFi.status() == WL_NO_SHIELD) { Serial.println("FAIL"); // if there's no WiFi shield, stop here. while(true); } while(wifiStatus != WL_CONNECTED) { Serial.print("WiFi:"); wifiStatus = WiFi.begin(WIFI_SSID, WIFI_PASSWORD); if (wifiStatus == WL_CONNECTED) { Serial.println("OK"); } else { Serial.println("FAIL"); } delay(1000); } Serial.println("Waiting for an ip address"); while (WiFi.localIP() == INADDR_NONE) { // print dots while we wait for an ip addresss Serial.print("."); delay(300); } Serial.println("\nIP Address obtained"); // We are connected and have an IP address. // Print the WiFi status. printWifiStatus(); } void serverprog() { while (client.available()) { char c = client.read(); Serial.write(c); } if (millis() - lastConnectionTime > postingInterval) { httpRequest(); } } void httpRequest() { // close any connection before send a new request. // This will free the socket on the WiFi shield client.stop(); // if there's a successful connection: if (client.connect(server, 80)) { Serial.println("connecting..."); char msgg[200]; sprintf(msgg,"GET /update?api_key=xxxxxxxxxxxxxxxx&field1=%f&field2=%d",temp,count); //have to make account on thingspeak.com and create channel then create 2 fields. then copy the WRITE API key in place of xxxxxxxxx // send the HTTP PUT request: client.println(msgg); client.println("Host: api.thingspeak.com"); client.println("User-Agent: Energia/1.1"); client.println("Connection: close"); client.println(); // note the time that the connection was made: lastConnectionTime = millis(); } else { // if you couldn't make a connection: Serial.println("connection failed"); } } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print your WiFi IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); // print the received signal strength: long rssi = WiFi.RSSI(); Serial.print("signal strength (RSSI):"); Serial.print(rssi); Serial.println(" dBm"); } void setup() { lcd.begin(16, 2); Serial.begin(9600); Serial.println("processing......"); } void loop() { int sensorValue1 = analogRead(A0); lcd.clear(); lcd.setCursor(0,2); lcd.print("wait.."); /* lcd.setCursor(0,0); lcd.print("temperature ="); lcd.setCursor(14,0); lcd.print(temp);*/ Serial.println(sensorValue1); volt=sensorValue1*3.22; temp=volt/10; Serial.println(volt); Serial.println("temp="); Serial.println(temp); delay(10); int sensorValue2; unsigned long start=millis(); analogReadResolution(10); unsigned long currentValue; float x=0; int y; count=0; delay(3000); lcd.clear(); lcd.setCursor(0,2); lcd.print("detecting......."); do { int sensorValue2 = analogRead(A1); if(sensorValue2 > x) { x=sensorValue2; y=1; } else if(sensorValue2 < x) { x=sensorValue2; if(y==1) { count++; y=0; } } currentValue=millis(); } while(currentValue-start<=30000); count=(count*2)/10000; lcd.clear(); lcd.setCursor(0,0); lcd.print("temperature ="); lcd.setCursor(14,0); lcd.print(temp); lcd.setCursor(0,2); lcd.print("pulse count ="); lcd.setCursor(14,1); lcd.print(count); delay(1000); Serial.println(sensorValue2); Serial.println("pulse count="); Serial.println(count); checkconnection(); delay(3000); if (!attempted) { Serial.println("Running SendAnEmail..."); TembooChoreo SendEmailChoreo(client); SendEmailChoreo.begin(); SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT); SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); SendEmailChoreo.setAppKey(TEMBOO_APP_KEY); SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail"); SendEmailChoreo.addInput("Username", GMAIL_USER_NAME); SendEmailChoreo.addInput("Password", GMAIL_APP_PASSWORD); SendEmailChoreo.addInput("ToAddress", TO_EMAIL_ADDRESS); SendEmailChoreo.addInput("Subject", "Recieved An Email???"); char msg[100]; sprintf (msg," Body Temperature=%f, Pulse count=%d",temp,count); SendEmailChoreo.addInput("MessageBody", msg); unsigned int returnCode = SendEmailChoreo.run(); if (returnCode == 0) { Serial.println("Success! Email sent!"); } else { while (SendEmailChoreo.available()) { char c = SendEmailChoreo.read(); Serial.print(c); } } SendEmailChoreo.close(); } serverprog(); lcd.clear(); }
  25. Rei Vilo

    Energia FAQ

    Some topics come aver and over again. Here are the most frequent questions. Wouldn't be nice to have all of them in one single place? Listed questions: Netiquette for Newbies What Information to Provide When Asking for Help I²C Check-List Porting an Arduino library to Energia Use Pins Number instead of Pins Names with Energia Add a New Board to Energia LaunchPad and BoosterPack Pins Maps Boards Supporting the Galaxia Library Netiquette for Newbies What Information to Provide When Asking for Help I²C Check-List Porting an Arduino library to Energia
×