[Solved] Writing stm32 ADC values to SD card

if(f_mount(&myFAT,SD_Path, 1)==FR_OK) { HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_14); f_open(&myFile, “test1.txt\0″,FA_WRITE|FA_CREATE_ALWAYS); for(int i=0; i<1000;i++){ sprintf(msg,”%hu\r\n”,data[i]); f_write(&myFile,msg,10,&byteCount); } f_close(&myFile); HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_15); } 1 solved Writing stm32 ADC values to SD card

[Solved] Error trying to swap Card Objects in a vector c++

To pick out some key lines from you error In instantiation of ‘void std::swap(_Tp&, _Tp&) [with _Tp = Card]’: use of deleted function ‘Card& Card::operator=(Card&&)’ ‘Card& Card::operator=(Card&&)’ is implicitly deleted because the default definition would be ill-formed: non-static const member ‘const int Card::numFace’, can’t use default assignment operator You are trying to use std::swap with … Read more

[Solved] Apply get set for methods? [closed]

The answer is: it depends. I’ll try to help you to reformulate your question: does it make any sense to return a function rather than computed result from another fuction? Then I would say: definitely yes (let me know if you’d like to know ehy, I’ll update this post). But the example you showed does … Read more

[Solved] Just input a number in cpp [closed]

I think this is what you are looking for: #include <iostream> #include <string> #include <cctype> int main () { std::string input; bool valid; do { valid = true; std::cin >> input; for (char c : input) if (! std::isdigit( static_cast<unsigned char>(c) ) ) valid = false; } while (! valid); // Here the string is … Read more

[Solved] Error when accessing array – stack around the variable ‘scores’ was corrupted [closed]

It seems that this declaration: int scores[5]; Is incorrect. This creates an array with 5 numbers in it, indices from scores[0-4], however, you constantly refer to score[5], the sixth element of the array throughout your program. I recommend changing to int scores[6]; 2 solved Error when accessing array – stack around the variable ‘scores’ was … Read more

[Solved] why arrayList.sort() doestnt work with me?

You are adding two byte arrays in your ArrayList and trying to sort them. Since sorting is performed on a comparison basis… at runtime your application complains about a missing criterion for defining a priority between the two arrays. public class BytesComparer : IComparer { Int32 IComparer.Compare(Object x, Object y) { Byte[] left = (Byte[])x; … Read more

[Solved] Why is this NaN

double weekly_sales[weeks][salespersons][days]; double total_weekly_sales[weeks]; Uninitialized. Edit: this is how you should initialize them: double weekly_sales[weeks][salespersons][days] = { { { 0.0 } } }; 5 solved Why is this NaN

[Solved] C++’s min_element() not working for array [closed]

Note, that std::min_element() returns an iterator to a minimal value, not the value itself. I doubt that you get this error based on the above code alone: assuming proper include directives and using directives the code compiles OK although it would print the address of the minimum element rather than its value. Most likely your … Read more

[Solved] Sort elements by placing elements with odd number index first and even indexes in the end of an array in C [closed]

you can find a typical solution here ` #include<stdio.h> void swap(int *a, int *b); void segregateEvenOdd(int arr[], int size) { /* Initialize left and right indexes */ int left = 0, right = size-1; while (left < right) { /* Increment left index while we see 0 at left */ while (arr[left]%2 == 0 && … Read more

[Solved] Strings are not printed in accordance with the way they are allocated

Errors were not detected because either the warnings of your compiler are not enabled, being ignored or need for a better compiler. This code does not allocate space for data being read. Simplest solution: used fixed size arrays and limit user input. #include <stdio.h> int main(void) { char colorOne[80+1]; printf(“How many bands??\n”); … printf(“\n\nEnter your … Read more