WouoUI/Third-party-design/Emulator/Arduino/ArduinoCompatible.cpp

20 lines
403 B
C++
Raw Normal View History

2023-07-06 23:40:07 +08:00
#include <cstdlib>
#include <unordered_map>
#include <SDL_keycode.h>
#include <SDL_events.h>
#include "ArduinoCompatible.h"
class Serial Serial;
long map(long value, long fromLow, long fromHigh, long toLow, long toHigh) {
return (value - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow;
}
static float a = 0;
int analogRead(int pin) {
a = a + 1;
return sin(0.1f * a)*1023;
}