[Solved] Writing stm32 ADC values to SD card

[ad_1] 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 [ad_2] solved Writing stm32 ADC values to SD card

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

[ad_1] 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 … Read more

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

[ad_1] 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 … Read more

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

[ad_1] 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 … Read more

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

[ad_1] 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 [ad_2] solved Error when accessing array – stack around the variable … Read more

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

[ad_1] 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 = … Read more

[Solved] Why is this NaN

[ad_1] 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 [ad_2] solved Why is this NaN

[Solved] How to Parse the txt file in c# [closed]

[ad_1] Start with this: var lines = File.ReadAllLines(“<your path/filename>”); var stringBags = lines.Select(l => l.Split(‘|’)); var objects = stringBags.Select(b => new {Id = b[0], Name = b[1], SomeOtherField = b[2]}); This gives you a way to parse the file, and to project it into some sort of object you can deal with 2 [ad_2] solved … Read more

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

[ad_1] 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 … 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]

[ad_1] 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

[ad_1] 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 … Read more