Problem with passing data from DHT11 to an LCD [closed] - c

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 days ago.
Improve this question
It might be an stupid question since im starting with C. But as the title say im trying to get the LCD to read the data (temperature and humid) from the DHT. The problem is that in the library im using the first one read just uint8 and the second gives int data.
I tried to transform the DHT11 data using "uint8_t temperatura = (uint8_t) temp;" but it doesnt seem to be working since the LCD just gives random symbols.
I dont know if that kind of transformation from int to uint8 is too "rusty" so the program is not doing a good work, or the most probably thing that im messing it up in someway.
Im using the UNO kit with an atmega328p.
Anyway, i would appreciate the guidance or suggestions!
Edit: I wasn't able to post the code with the format required so i'll leave it in a picture:
https://i.stack.imgur.com/u57od.png

Related

Count amount of words, characters, newlines in C [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I know it is not recommended to post code as an image, since I am getting a formatting error when trying to post code on here. Anyway, I am trying to write a simple C program to count number of words, characters, newlines using do while loop. However, the output is not as expected. Please help!
Instead of a do-while, you should try using while. Since your code starts off by checking whether a is any of your if cases, it goes to the else case, and increments the New line variable. If possible, could you share the output screen.

Weird issue in C [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
thanks for your help.
I'm trying to similate a simplified version of ARM, and I have a very weird error in c http://pastebin.com/3XRdngty .
I don't understant why in the function executer_code(),
the for doesn't work ...
I mean it should be looping untill the variable "i" is equal to the variable nombre_instruction, but it turns out that the variable "nombre_instruction" is the right value the first time it goes in the for, but the second time it doesn't go in the for because its value changed to 0, I search on the internet if someone has the same kind of error, and i didn't find anything.I reread my code but still I cannot figure out why it does this, 3 hours has passed already.
And thank you again for you help :)
This is taken from your code:
char *compar;
if(i==0){
sprintf(&compar,"%c%c%c%c",code[0],code[1],code[2],code[3]);
}
The problem here is that you declare compar as a pointer to char, but it is uninitialized. So, it has an undefined value. When you fill it with sprintf, you just write somewhere in the memory, and apparently, you write over the variable nombre_instruction.
Solution:
char compar[200];

Converting a character into a space in C arrays [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
So lets say I have received a message that resembles the following
"L2N5*8R10!11T0A1K3Y14#4W7O6O9C12R13"
and I am expected to sort out the characters in accordance to the numbers succeeding them and change the characters that are not letters into a space. I have no problem doing the sorting out part, I am only having a trouble while trying to write a function that will change those characters into space.
The out put should be something like this
TALK NOW OR CRY
but I am getting
TALK#NOW*OR!CRY
Can anyone help me figure out what my function should look like so that I can be able to change the characters into space??
Unless you show your code, we'll only be able to guess!!
However, as a general suggestion, I would recommended, you should check each entry against isalpha(). In case you got a return value of 0, replace the entry with a .

LUA shows errors where there are not [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have managed to "translate" an entire code written in C to LUA, the source code permits to drive an 5110/3110 LCD and I have tried not to modify the code, but the port names, because I will run it on a router and use the LED as GPIO pins.
Anyway... I've been translating about 3 hours and now I'm done, but it wont run, it shows me errors, wherer I can't find one... For me it seems good.
C Source: http://www.est.ipcb.pt/pessoais/alexandre_t/fon_LCD/3310_ex_1.c
My translated LUA Script: https://gist.github.com/anonymous/62cc0897ede3cb788baa
The first error it gives me ìs that Screen.lua:26: '(' expected near 'local'
But there don't seem to be an error...
If anyone could revise my code and point me forward, I would be very glad.
The error seems pretty obvious based on the error message. Missing ( exactly as the error message says at exactly the line it says.
function posicao
local x1=0
...
end
Should be
function posicao()
local x1=0
...
end

Using greeks characters and sub-superscript in Win32 with C [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I need to set some labels in an engineering software GUI using greek characters and sub or super-scripts.
Could someone explain me how to do this programming in C with Win32?
You will need to instantiate either a web browser control (very heavy, but understands HTML, which is easy,) or a read-only rich text control. (Which is more lightweight but you will have to learn how to format text in it.)
If you've got a label, say, HWND static, you can set its text via SetWindowText(static, L"Unicode_text_ффф");. You might want to explicitly use SetWindowTextW, which is the Unicode version of the function.

Resources