Jump to content

yellamo

Members
  • Content Count

    6
  • Joined

  • Last visited

Everything posted by yellamo

  1. yellamo

    String Concatenation with Long

    Hi @@roadrunner84, Sorry for the delay getting back! Thanks for the pointers about the float. I've tried the code, had to change the ints to double as there was an error, and getting the following output - I've got a digital themomethere here and it is showing 21c. double deg, deg100; char diet[8]; deg100 = modf(tmp006.readDieTempC(), °) * 100; sprintf(diet, "%u.%02u", deg, deg100); Serial.print("\r\n\DIET ");Serial.print(diet); The error with the int was as follows: error: cannot convert 'int*' to 'double*' for argument '2' to 'double modf(double, double*)' Thanks
  2. Hi Guys, I've posted an issue over on the Ti website but they have suggested posting in an Energia forum too. The issue I am seeing is when concatenating a string and a long number. It either goes one of two ways - the value is zeros, or the numbers following the decimal point are missing. https://e2e.ti.com/support/wireless_connectivity/f/968/t/414222 //This works fine static float diet = tmp006.readDieTempC(); Serial.print("Die Temperature: "); Serial.print(diet); Serial.println("*C"); //This doesnt String pubString = "Temperature " + long(diet); Serial.print(pubString); The following gives zeros: String pubString = "Temperature Test "; pubString += diet; Serial.print(pubString); Thanks
  3. yellamo

    String Concatenation with Long

    Thanks @@roadrunner84, The issue is with the float. I can construct the JSON fine in string, but everything after the decimal point in the float is trimmed. static float diet = tmp006.readDieTempC(); //This Displays fine - from standard TMP006 Example Serial.print("Die Temperature: "); Serial.print(diet); Serial.println("*C"); //This example with "long" will only give a value before decimal, as exptected, but I need the exact value eg. 20.12. String pubString = "{\r\n\"abc\":" + String1 + ",\r\n\"temp\":" + long(diet) + ",\r\n\"def\":" + String2 + "\r\n}"; //What I get {"abc":"123456", "temp":"20", "def":"1234"} //What I Need {"abc":"123456", "temp":"20.24", "def":"1234"} I am trying to get the float value of diet into a string, but all efforts within my sketch make it be "0.00". When I try your examples and those from ti.com, they work fine in a new sketch, but not in mine, even if I do this at the very start of the program.. Thanks
  4. yellamo

    String Concatenation with Long

    Hi RoadRunner, Thanks for the helpful reply. Ultimately I want to construct a string of multiple values which can be posted as a JSON value. I have tried both the examples and the second one is very good, but I am having the same issue with this bit of code - it works fine in a new sketch, but once I add this into my sketch with all the code in, it returns zeros! The same goes for another piece of code suggested there too: String pubString7; char buffer1[8]; float diet1 = 40.05; sprintf(buffer1, "%.2f", diet1); pubString7 = "\r\n\Temperature Test : "; pubString7 += buffer1; Serial.println(pubString7); I am just about to reply over there, but it was originally looking like an issue with SPI.h. Here are my imports (which does not make a difference on my main sketch: #ifndef __CC3200R1M1RGC__ #endif #include <WiFi.h> #include <PubSubClient.h> #include <math.h> #include "Adafruit_TMP006.h" #include <Wire.h> #include <stdlib.h> Any help greatly appreciated. Thanks
  5. yellamo

    Energia & CCS Libraries

    Yep, made sure they matched what was on the video - Its at 8.00min
  6. yellamo

    Energia & CCS Libraries

    Hi Guys, Having a nightmare getting CCS setup even following the SimpleLink Wi-Fi CC3200 Project 0: Code Composer Studio IDE I keep getting the following errors: Cortex_M4_0: GEL Output: Memory Map Initialization Complete Cortex_M4_0: Failed CPU Reset: This operation is not supported by this driver Cortex_M4_0: GEL Output: Target Reset Cortex_M4_0: Trouble Writing Memory Block at 0x20004000 on Page 0 of Length 0x7ff0: This operation is not supported by this driver Cortex_M4_0: File Loader: Verification failed: Target failed to write 0x20004000 Cortex_M4_0: GEL: File: C:\Users\Laptop\workspace_v6_1\wlan_station\Release\wlan_station.out: Load failed. Energia is working fine, so wondering is there a way to import the CCS examples into Energia with all the dependencies/includes? If anyone has a better getting started guide/video please do let me know! Thanks
×