Форум обсуждения систем  

Вернуться   Форум обсуждения систем "Умный дом", проектов Ардуино, OpenWRT и других DIY устройств > Форум умного дома > Сделай сам

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.02.2015, 22:09   #1
Bulatovor
Senior Member
 
Регистрация: 20.01.2013
Адрес: Уфа
Сообщений: 444
Вес репутации: 800
Bulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond reputeBulatovor has a reputation beyond repute
По умолчанию Re: Многоканальный Dimmer, работающий в фоновом режиме

Судя по всему не поддерживает -у меня даже примеры не компилирует
Bulatovor вне форума   Ответить с цитированием
Старый 26.02.2015, 22:23   #2
Arduino
Junior Member
 
Регистрация: 25.02.2015
Адрес: Санкт-Петербург
Сообщений: 5
Вес репутации: 0
Arduino is an unknown quantity at this point
По умолчанию Re: Многоканальный Dimmer, работающий в фоновом режиме

Цитата:
Сообщение от Admin Посмотреть сообщение
Все верно, но что бы понять ошибку нужно Ваш код видеть
Цитата:
Сообщение от Bulatovor Посмотреть сообщение
Судя по всему не поддерживает -у меня даже примеры не компилирует
Да, стандартный пример не компилируется:
PHP код:
#include <TimerThree.h>

// This example uses the timer interrupt to blink an LED
// and also demonstrates how to share a variable between
// the interrupt and the main program.


const int led LED_BUILTIN;  // the pin with a LED

void setup(void)
{
  
pinMode(ledOUTPUT);
  
Timer3.initialize(150000);
  
Timer3.attachInterrupt(blinkLED); // blinkLED to run every 0.15 seconds
  
Serial.begin(9600);
}


// The interrupt will blink the LED, and keep
// track of how many times it has blinked.
int ledState LOW;
volatile unsigned long blinkCount 0// use volatile for shared variables

void blinkLED(void)
{
  if (
ledState == LOW) {
    
ledState HIGH;
    
blinkCount blinkCount 1;  // increase when LED turns on
  
} else {
    
ledState LOW;
  }
  
digitalWrite(ledledState);
}


// The main program will print the blink count
// to the Arduino Serial Monitor
void loop(void)
{
  
unsigned long blinkCopy;  // holds a copy of the blinkCount

  // to read a variable which the interrupt code writes, we
  // must temporarily disable interrupts, to be sure it will
  // not change while we are reading.  To minimize the time
  // with interrupts off, just quickly make a copy, and then
  // use the copy while allowing the interrupt to keep working.
  
noInterrupts();
  
blinkCopy blinkCount;
  
interrupts();

  
Serial.print("blinkCount = ");
  
Serial.println(blinkCopy);
  
delay(100);

Возможно есть библиотека для нулевого таймера, но его вроде не советуют использовать.
Arduino вне форума   Ответить с цитированием
Ответ


Здесь присутствуют: 4 (пользователей: 0 , гостей: 4)
 

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход


Текущее время: 22:52. Часовой пояс GMT +3.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd. Перевод: zCarot
Яндекс.Метрика