- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
i think this is a noob question here, but anyway. My application involves interfacing an ADXL345 with the PSOC4 BLE, over SPI, and communicating the data to the computer serially via UART.
However, im unale to send the integer data over UART. Here's a short code that im trying to run :
the idea is to print "784.4564549" onto my serial monitor.
int bytesWritten;
char myString[50];
bytesWritten = sprintf(myString, "%f", myFloat);
UART_UartPutChar(myString);
UART_UartPutString("\r\n");
However, all that the serial monitor prints is a dash!
Any suggestions on how else to send an integer over UART? thanks 🙂
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sprintf() needs some settings to work:
In "Project -> Build settings -> Linker" you'll have to set "Use newlib nano" and "Use newlib nano float formatting"
In .cydwr-view (where you assign the pins) under "System" tab set the heap size to 0x100, better 0x200.
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sprintf() needs some settings to work:
In "Project -> Build settings -> Linker" you'll have to set "Use newlib nano" and "Use newlib nano float formatting"
In .cydwr-view (where you assign the pins) under "System" tab set the heap size to 0x100, better 0x200.
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,thanks for the input.
Made the linker chnages.
cant seem to edit heap size....its fixed/non editable.
meanwhile, no outputs - not even dashes as i ws getting earlier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can't edit the heap size while debugging.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi mr vedant.prusty.could u runing adxl345 with spi?because i cant volved this problem!!!
can u give me your project for learning how i can to do?
tanks...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It would be very nice to stop flooding the forum with your requests which are all the same.
Obviously no one here is able (willing) to provide you with a complete project, so you need to learn from the examples or videos that you can access from creator. When you have got a complete project that builds without errors/warnings you may post a workspace bundle together with some description what runs and what does not run. Based on that there will be someone to help you.
Bob