Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char recebido[4] ;
- bool flag = false;
- ///////////////////////////////////////////////////////////////
- void setup() {
- Serial.begin(115200);
- }
- ///////////////////////////////////////////////////////////////
- void loop() {
- if (Serial.available() >= 2)
- {
- int i = 0;
- while (Serial.available() > 0)
- {
- recebido[i] = Serial.read();
- i++;
- delay(1);
- flag = true;
- }
- }
- if (flag == true)
- {
- long total = 1;
- flag = false;
- for ( int i = 0; i < 4; i++)
- {
- total = (int)recebido[i] * total;
- }
- if(total > 0)
- Serial.println(total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement