• Announcements

    • bluehash

      Forum Upgrade   03/11/2017

      Hello Everyone, Thanks for being patient while the forums were being fixed and upgraded. Please see details and report issues in this thread. Thanks!

Search the Community

Showing results for tags 'json'.



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

  • Community Calendar

Found 1 result

  1. Hello Forums I am trying to use GUI Composer v2 (on the cloud) to create a GUI for a battery managment system, similar to the one in the SLAA478 Application Report, using the MSP-EXP430F5529LP and bq76PL536EVM-3. I've decided to use USB/Serial comms, which requires me to modify the code to send the information using JSON. I am following the example of using USB/Serial IO: https://dev.ti.com/gc/designer/help/Tutorials/Serial/index.html. The code given is as follows: #include <aJSON.h> // most launchpads have a red LED #define LED RED_LED //see pins_energia.h for more LED definitions void printled_statewithjson(int state){ aJsonObject* root = aJson.createObject(); if (root == NULL) { return; } aJson.addItemToObject(root, "LED", aJson.createItem(state)); char* string = aJson.print(root); if (string != NULL) { Serial.println(string); free(string); } aJson.deleteItem(root); } // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(LED, OUTPUT); Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level) printled_statewithjson(1); // print json object with LED status set to 1 to UART delay(1000); // wait for a second digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW printled_statewithjson(0); // print json object with LED status set to 0 to UART delay(1000); // wait for a second } I am trying to fully understand this example code, before implementing it into my program. Using CCS Cloud, I stepped through the program in debug mode. From what I understand, the loop() function is essentially the main function, which blinks the LED; setup() does as expected and initializes the MCU LED pin, and opening a serial port at 9600 baud rate. I cannot, however, understand the printled_statewithjson() function. How exactly does it work to be able to send the information? Regards