made array
This commit is contained in:
parent
88415ddec1
commit
427000ff9e
@ -24,8 +24,8 @@ extern "C" {
|
||||
#include <avr/io.h>
|
||||
#include <avr/cpufunc.h>
|
||||
int RTC_init();
|
||||
int fan_speed(float voltage_value);
|
||||
inline void fan_speed_toggle();
|
||||
int read_array_get_RPM(int voltage_value);
|
||||
inline void put_in_array();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -41,35 +41,31 @@ int RTC_init() {
|
||||
| RTC_PITEN_bm; /* Enable: enabled */
|
||||
|
||||
}
|
||||
// skal lage en som finner data hvert ... sekund. Datane skal samles inn i en array. Når arrayen er full skal jeg regne ut rpm. Vet t det er ... mange sek mellom så blir enklere. så noe signalbehandling shit.
|
||||
int read_array_get_RPM(int voltage_value) {
|
||||
|
||||
int fan_speed(float voltage_value) {
|
||||
int counter = 0;
|
||||
int old_value = 0;
|
||||
|
||||
if (voltage_value > 300 && old_value < 300) {
|
||||
counter++;
|
||||
}
|
||||
voltage_value = old_value;
|
||||
return old_value;
|
||||
}
|
||||
|
||||
inline void fan_speed_toggle() {
|
||||
float fan_speed;
|
||||
float t = 0;
|
||||
f = ((1 / t)*1000);
|
||||
fan_speed = (f * 60) / 2;
|
||||
return fan_speed;
|
||||
}
|
||||
|
||||
inline void put_in_array() {
|
||||
int voltage_value [30] = {};
|
||||
for(int i = 0; i <30; i++)
|
||||
scanf("%d", &voltage_value[i]);
|
||||
|
||||
}
|
||||
|
||||
ISR(RTC_PIT_vect) {
|
||||
RTC.PITINTFLAGS = RTC_PI_bm;
|
||||
fan_speed_toggle();
|
||||
|
||||
put_in_array();
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
fan_speed();
|
||||
RTC_init();
|
||||
sei();
|
||||
read_array_get_RPM();
|
||||
RTC_init();
|
||||
while (1) {
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user