These are chat archives for esp8266/Arduino

29th
Nov 2015
Martin Ayotte
@martinayotte
Nov 29 2015 00:16
No problem, as long as you are aware that you cannot drive source but only sink.
brutzler
@brutzler
Nov 29 2015 00:16
To your explanation of the quasi-bidirectional. Is the following OK?
1.) When I want to use a pin as output, then hardware should be as (e.g. for a LED): 5V -> Resistor -> LED -> PINx of PCF85744. The LED is active, when I write a LOW to PINx
2.) When I want to use a pin as input, then hardware should be as (e.g. for a button): PINx of PCF85744 -> Button -> GND . Pinx should be HIGH with 'write( x, HIGH)'. And I can read out the state of the button with 'read(x)'. Receiving a LOW means button pressed.
3.) Additional question: Has anyone experience with the need of debouncing? Connecting a button to a GPIO, I know the need of this, but over I2C?
Martin Ayotte
@martinayotte
Nov 29 2015 01:00
Hi brutzler, 1) Yes ! So, you understood well source/sink difference. 2) Yes also ! you understand the PCF8574 specs which says that output must be HIGH in order to read input. 3) Debouncing ? That 's all depend of your app, maybe not needed at all, maybe it can be done in software, worst-case scenario, do it in hardware with a capacitor.
Stavros Korokithakis
@skorokithakis
Nov 29 2015 01:39
hey everyone
i have a type problem and i'm not sure what to do
i'm receiving a String that's actually bytes, and i want to convert it to unsigned char[], how can i do that? i tried snprintf but it's complaining
i'm trying to pass it to a function with this signature: void cmdSend(char pin, unsigned char message[], unsigned char repeat, unsigned int intraDelay, unsigned int multiplier)
Sven Eliasson
@comino
Nov 29 2015 01:42
"String that's actually bytes" . So you have a String object or a byte array?
Stavros Korokithakis
@skorokithakis
Nov 29 2015 01:42
i have a String object, but it contains bytes, semantically
Sven Eliasson
@comino
Nov 29 2015 01:42
generally "casting" is the thing to do ;)
Stavros Korokithakis
@skorokithakis
Nov 29 2015 01:43
so i want to do if payload[0] = 'a'
will it work properly if i just cast it?
no need to copy, then?
Sven Eliasson
@comino
Nov 29 2015 01:43
most probably no
try (uint8_t) infront of your var
like data.write( (uint8_t*) buffer, strlen(buffer) );
Stavros Korokithakis
@skorokithakis
Nov 29 2015 01:44
this particular one is the "char pin" part of the function
oh
hmm, i'm confused, because there's no one place where i cast it
i'm trying to split it, as above, into a char, an unsigned char[], an unsigned char, etc
so:
Sven Eliasson
@comino
Nov 29 2015 01:45
code snippet would be helpful :)
Stavros Korokithakis
@skorokithakis
Nov 29 2015 01:45
cmdSend((char) payload[2], &payload[5], payload[3], payload[4] * DELAY_MULTIPLIER, payload[1]);

void cmdSend(char pin, unsigned char message[], unsigned char repeat, unsigned int intraDelay, unsigned int multiplier);
the first is (kind of) the string being split to fit into the declaration (second)
Stavros Korokithakis
@skorokithakis
Nov 29 2015 01:52
any idea how i can do it?
it was originally an unsigned char[] that was working fine, but trying to snprintf the String into an unsigned char[] fails with type errors
Sven Eliasson
@comino
Nov 29 2015 01:56
Since Im more the C guy Im not so familiar with the String object and try to avoid where possible. Just a uneducated hint - Strings have a toCharArray() member function. Did u try that?
Stavros Korokithakis
@skorokithakis
Nov 29 2015 01:56
oh interesting, that would be great, let me try
Sven Eliasson
@comino
Nov 29 2015 01:58
(with so many arguments containing "payload". Cant u just handle the full String and do the data confectioning inside the function?
Stavros Korokithakis
@skorokithakis
Nov 29 2015 02:08
i prefer my function definition to be clean, because in other places i call it with the actual unmarshalled data
Stavros Korokithakis
@skorokithakis
Nov 29 2015 02:22
how is this even invalid?: "invalid conversion from 'char' to 'unsigned char' "
Stavros Korokithakis
@skorokithakis
Nov 29 2015 02:28
i have managed to utter the correct incantation to make this compile
i can only imagine what Rust programmers have to go through :P
Stavros Korokithakis
@skorokithakis
Nov 29 2015 03:31
does anyone know what the process is to read the analog sensor? is it just analogRead(A0)? what's its voltage range?
ah, 1v-0v
Rohit Yermalkar
@romuye123
Nov 29 2015 09:48
facing issue with dimmer sketch
the lamp is flickering
Harrison Mclean
@h4rm0n1c
Nov 29 2015 10:01
Have you tried using yield() instead of delay(1)?
Rohit Yermalkar
@romuye123
Nov 29 2015 10:01
no
let me try
its still flickering
very fast
Harrison Mclean
@h4rm0n1c
Nov 29 2015 10:05

Oh crap! I just realized what the issue is.

You're not setting buttonFlag false anywhere!

Put buttonFlag = false; underneath the call to zero_crosss_int(); in loop()

Rohit Yermalkar
@romuye123
Nov 29 2015 10:05
i tried that as well
its not working
Harrison Mclean
@h4rm0n1c
Nov 29 2015 10:06
This message was deleted
Rohit Yermalkar
@romuye123
Nov 29 2015 10:07
the lamp is flickering
fast
is there a need to detachinterrupt ?
Markus
@Links2004
Nov 29 2015 10:11
no
Harrison Mclean
@h4rm0n1c
Nov 29 2015 10:11
Nah.
Markus
@Links2004
Nov 29 2015 10:12
i think the code needs a rewrite to work with a timer to get the timing working.
i took the code from here
the dimming works well
my problem is the LAMP does not stays at ONE fixed value of dimming
the program crashes on extreme values of dimming
Markus
@Links2004
Nov 29 2015 10:16
the different between a AVR aduino and the ESP is that the ESP has a rtos that is running in the backround and is dealing with wifi and other stuff.
the crash is a WDT reset i think, because the original code is blocking to long in the interrupt.
Rohit Yermalkar
@romuye123
Nov 29 2015 10:16
what changes we need to do for ESP ?
Harrison Mclean
@h4rm0n1c
Nov 29 2015 10:16
That's really close to what I was going to say.
Markus
@Links2004
Nov 29 2015 10:17
your latest code try to move the code in the loop outside of the IRQ, basiclly a good idea no crash any more i think but between the loop calles the RTOS is working and that is the reason why your lamp is flickering
the code needs a redesign.
basic:
IRQ starts a HW timer that then triggers the triac, by this the irq time is short and it shut work very well,
and it shut be possible the dimm the lamp by wifi to.
Harrison Mclean
@h4rm0n1c
Nov 29 2015 10:19

Yeah, the AVR runs only your code, but the esp8266 has housekeeping functions that need to run in the background interspersed between loops.

This is why the software delays and timers might not be working for you. I moved to Timer0 for a library port for this very reason.

Rohit Yermalkar
@romuye123
Nov 29 2015 10:20
ok
if you can, please help me in that
Markus
@Links2004
Nov 29 2015 10:21
this line will most likely trigger the WDT:
delayMicroseconds(dimtime); // Off cycle
Rohit Yermalkar
@romuye123
Nov 29 2015 10:21
ok
but if we dont keep this line, it wont create firing angle
for triac
Markus
@Links2004
Nov 29 2015 10:23
yes thats way this part need to be rewrite to use a HW timer
@h4rm0n1c you habe a Timer0 port for ESP?
Harrison Mclean
@h4rm0n1c
Nov 29 2015 10:28
Nah, I just figured out the API and used it based on the code that was already in the project for PWM and Servo control.
I meant I was porting a library which needed accurate timing and ended up using timer0.
I really should just make a port of that too now that you mention it.
Markus
@Links2004
Nov 29 2015 10:33

#include <Arduino.h>

const int AC_LOAD = 3;    // Output to Opto Triac pin
const int AC_NULL = 0;    // Input pin for Null point of sinus

int dimming = 128;  // Dimming level (0-128)  0 = ON, 128 = OFF

void timer_handler(void) {
    //disable timer
    timer0_detachInterrupt();

    digitalWrite(AC_LOAD, HIGH);   // Fire the TRIAC
    delayMicroseconds(10);         // triac On propogation delay (for 60Hz use 8.33)
    digitalWrite(AC_LOAD, LOW);    // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC
}

//the interrupt function must take no parameters and return nothing
void zero_crosss_int()  //function to be fired at the zero crossing to dim the light
{
    // Firing angle calculation : 1 full 50Hz wave =1/50=20ms
    // Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle)
    // For 60Hz => 8.33ms (10.000/120)
    // 10ms=10000us
    // (10000us - 10us) / 128 = 75 (Approx) For 60Hz =>65

    int dimtime = (75 * dimming);    // For 60Hz =>65
    // delayMicroseconds(dimtime);    // Wait till firing the TRIAC

    noInterrupts();
    timer0_attachInterrupt(timer_handler);
    timer0_write(ESP.getCycleCount() + (41.66f * dimtime));
    interrupts();
}

void setup() {
    pinMode(AC_LOAD, OUTPUT); // Set AC Load pin as output
    pinMode(AC_NULL, INPUT);

    Serial.begin(115200);

    noInterrupts();
    timer0_isr_init();
    interrupts();

    attachInterrupt(AC_NULL, zero_crosss_int, RISING);  // Choose the zero cross interrupt # from the table above
}

void loop() {
    for(int i = 5; i <= 128; i++) {
        dimming = i;
        delay(10);
    }
}
@romuye123 try this one
Rohit Yermalkar
@romuye123
Nov 29 2015 10:35
ok ok
Rohit Yermalkar
@romuye123
Nov 29 2015 10:43
nopes
does not works, the program crashes after 15-20 seconds
and it does not even fires the AC_LOAD
Markus
@Links2004
Nov 29 2015 10:48
ok new try:
#include <Arduino.h>

const int AC_LOAD = 3;    // Output to Opto Triac pin
const int AC_NULL = 0;    // Input pin for Null point of sinus

int dimming = 128;  // Dimming level (0-128)  0 = ON, 128 = OFF

void timer_handler(void) {
    digitalWrite(AC_LOAD, HIGH);   // Fire the TRIAC
    delayMicroseconds(10);         // triac On propogation delay (for 60Hz use 8.33)
    digitalWrite(AC_LOAD, LOW);    // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC
}

//the interrupt function must take no parameters and return nothing
void zero_crosss_int()  //function to be fired at the zero crossing to dim the light
{
    // Firing angle calculation : 1 full 50Hz wave =1/50=20ms
    // Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle)
    // For 60Hz => 8.33ms (10.000/120)
    // 10ms=10000us
    // (10000us - 10us) / 128 = 75 (Approx) For 60Hz =>65

    int dimtime = (75 * dimming);    // For 60Hz =>65
    // delayMicroseconds(dimtime);    // Wait till firing the TRIAC

    timer0_write(ESP.getCycleCount() + (41.66f * dimtime));
}

void setup() {
    pinMode(AC_LOAD, OUTPUT); // Set AC Load pin as output
    pinMode(AC_NULL, INPUT);

    Serial.begin(115200);

    noInterrupts();
    timer0_isr_init();
    timer0_attachInterrupt(timer_handler);
    interrupts();

    attachInterrupt(AC_NULL, zero_crosss_int, RISING);  // Choose the zero cross interrupt # from the table above
}

void loop() {
    for(int i = 5; i <= 128; i++) {
        dimming = i;
        delay(10);
    }
}
Krzysztof
@krzychb
Nov 29 2015 10:55
@romuye123 - have you checked this post http://www.esp8266.com/viewtopic.php?f=15&t=5440?
Rohit Yermalkar
@romuye123
Nov 29 2015 10:58
@krzychb its a nodemcu program
i have checked this already
if i am not wrong
Krzysztof
@krzychb
Nov 29 2015 11:01
@romuye123 - I believe this is Arduino ESP8266 - check this post http://www.esp8266.com/viewtopic.php?p=28820#p28820
Rohit Yermalkar
@romuye123
Nov 29 2015 11:01
i could not find the arduino sketch ?
@krzychb did you found sketch somewhere ?
Rohit Yermalkar
@romuye123
Nov 29 2015 11:07
@Links2004 the new try also did not worked :(
;(
Markus
@Links2004
Nov 29 2015 11:07
k last try:
use:
timer0_write(ESP.getCycleCount() + (clockCyclesPerMicrosecond() * dimtime));
some debugging out:
#include <Arduino.h>

const int AC_LOAD = 3;    // Output to Opto Triac pin
const int AC_NULL = 0;    // Input pin for Null point of sinus

int dimming = 128;  // Dimming level (0-128)  0 = ON, 128 = OFF

void ICACHE_RAM_ATTR timer_handler(void) {
    digitalWrite(AC_LOAD, HIGH);   // Fire the TRIAC
    delayMicroseconds(10);         // triac On propogation delay (for 60Hz use 8.33)
    digitalWrite(AC_LOAD, LOW);    // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC

    Serial.println("timer_handler");
}

//the interrupt function must take no parameters and return nothing
void ICACHE_RAM_ATTR zero_crosss_int()  //function to be fired at the zero crossing to dim the light
{
    // Firing angle calculation : 1 full 50Hz wave =1/50=20ms
    // Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle)
    // For 60Hz => 8.33ms (10.000/120)
    // 10ms=10000us
    // (10000us - 10us) / 128 = 75 (Approx) For 60Hz =>65

    int dimtime = (75 * dimming);    // For 60Hz =>65
    // delayMicroseconds(dimtime);    // Wait till firing the TRIAC

    timer0_write(ESP.getCycleCount() + (clockCyclesPerMicrosecond() * dimtime));

    Serial.println("zero_crosss_int");

}

void setup() {
    pinMode(AC_LOAD, OUTPUT); // Set AC Load pin as output
    pinMode(AC_NULL, INPUT_PULLUP);

    delay(2000);
    Serial.begin(115200);
    Serial.setDebugOutput(true);
    Serial.println("BOOTUP");

    noInterrupts();
    timer0_isr_init();
    timer0_attachInterrupt(timer_handler);
    interrupts();

    attachInterrupt(AC_NULL, zero_crosss_int, RISING);  // Choose the zero cross interrupt # from the table above
}

void loop() {
    for(int i = 5; i <= 128; i++) {
        dimming = i;
        delay(10);
    }
}
Rohit Yermalkar
@romuye123
Nov 29 2015 11:11
ok
Krzysztof
@krzychb
Nov 29 2015 11:12
@romuye123 - I did not find the sketch. I would ask freedom2000 on the forum - he published sketch for some other project
Rohit Yermalkar
@romuye123
Nov 29 2015 11:12
@Links2004 here is the output

BOOTUP
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer
ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

Markus
@Links2004
Nov 29 2015 11:14
is the wdt triggert when you remove the Serial prints in the interrupt?
Rohit Yermalkar
@romuye123
Nov 29 2015 11:15
no i have kept. should i remove ?
and show you output ?
Markus
@Links2004
Nov 29 2015 11:15
yes
at which GPIO you have the zero crossing input?
Rohit Yermalkar
@romuye123
Nov 29 2015 11:17
const int AC_NULL = 12

BOOTUP
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer_handler
timer
ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

after removing the serial print
const int AC_LOAD = 13; // Output to Opto Triac pin
const int AC_NULL = 12; // Input pin for Null point of sinus
Markus
@Links2004
Nov 29 2015 11:18
the print is still there.
Rohit Yermalkar
@romuye123
Nov 29 2015 11:18
i removed from zero_crosss_int
should i also remove from timer_handler?
Markus
@Links2004
Nov 29 2015 11:19
the other one ;)
what me wonder is that we never see "zero_crosss_int" only the timer
Rohit Yermalkar
@romuye123
Nov 29 2015 11:20
ok
still no zero cross

BOOTUP

ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

Markus
@Links2004
Nov 29 2015 11:22

k to strange thinks

  1. wdt
  2. no zero_crosss_int

have you a scope or logic analyzer to check the signal at GPIO12.

Rohit Yermalkar
@romuye123
Nov 29 2015 11:22
yes
my zero cross works fine
for FADER LOGIC
this works perfectly fine
smooth dimming
with 12 zero cross pin and 13 AC_LOAD pin
Markus
@Links2004
Nov 29 2015 11:27
right now i am out of ideas,
the code shut work.
and we shut see zero_crosss_int.
Rohit Yermalkar
@romuye123
Nov 29 2015 11:29
ok
Me No Dev
@me-no-dev
Nov 29 2015 11:48
maybe using the RX pin for the sketch is the problem?
after all you have serial enabled
Rohit Yermalkar
@romuye123
Nov 29 2015 11:48
i am not using RX pin
Me No Dev
@me-no-dev
Nov 29 2015 11:51
const int AC_LOAD = 3;
GPIO3 is UART RX
Rohit Yermalkar
@romuye123
Nov 29 2015 11:51
that was just sample
i replaced the pin numbers
Me No Dev
@me-no-dev
Nov 29 2015 11:52
what are they now?
Rohit Yermalkar
@romuye123
Nov 29 2015 11:52
const int AC_LOAD = 13; // Output to Opto Triac pin
const int AC_NULL = 12; // Input pin for Null point of sinus
Me No Dev
@me-no-dev
Nov 29 2015 11:54
are you shure that opto is pulling up the pin? How do you have it connected?
Chris Elsworth
@celsworth
Nov 29 2015 15:40
should interrupts work on GPIO4 when WiFi is in station mode?
I have a sketch that is working perfectly on seeing interrupts (FALLING) on GPIO4, until I add my WiFi.begin and then it stops
also tried GPIO2 with the same result, don't know whether trying others will be a waste of time
Chris Elsworth
@celsworth
Nov 29 2015 15:53
nm, seems ot work now, not sure what I did wrong
CHANGE seems to work, but not FALLING, I'll opena ticket with a simple test case
Me No Dev
@me-no-dev
Nov 29 2015 15:58
you sure your power is good?
if falling was working before wifi, code is not the cause
Chris Elsworth
@celsworth
Nov 29 2015 15:59
good point, does FALLING need a certain voltage level drop to trigger?
Me No Dev
@me-no-dev
Nov 29 2015 16:01
no, but if your supply is bad, it will generate oscilations and trigger will not get the correct level at the time of interrupt
Chris Elsworth
@celsworth
Nov 29 2015 16:01
scope shows a 3.24v to 120mV fall
Me No Dev
@me-no-dev
Nov 29 2015 16:01
put a large electrolitic cap on the power leads and see how things go
Chris Elsworth
@celsworth
Nov 29 2015 16:01
k
Me No Dev
@me-no-dev
Nov 29 2015 16:01
it had helped me tremendously
Me No Dev
@me-no-dev
Nov 29 2015 16:16
@celsworth esp8266/Arduino#1108
this might help
@celsworth esp8266/Arduino#1106 this as well
Chris Elsworth
@celsworth
Nov 29 2015 16:21
oh nice, I'll try the current git HEAD and see if things change, thanks!
Me No Dev
@me-no-dev
Nov 29 2015 16:21
tthose two are not merged yet
but changes are really small so you can do it yourself
Chris Elsworth
@celsworth
Nov 29 2015 16:21
yep
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:27
hello
i have an array of packed 2-byte ints that i transmit over the network and read into an unsigned char array. how can i interpret them as ints again?
so i have the string "\x01\x00\x01\x01" and want to interpret it as [256, 257]
Me No Dev
@me-no-dev
Nov 29 2015 16:31
#define hex_char_to_byte(c) (((c)>='a'&&(c)<='f')?((c)-87):((c)>='A'&&(c)<='F')?((c)-55):((c)>='0'&&(c)<='9')?((c)-48):0)
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:31
fantastic, thanks
Me No Dev
@me-no-dev
Nov 29 2015 16:31
so you read the \x part then you read each hex digit and shift the result properly
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:31
although it's not hex chars, it's just unsigned chars
sorry, that was python encoding
\x01 is just one byte
Me No Dev
@me-no-dev
Nov 29 2015 16:32
but 8 bits = 2 hex chars
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:32
yes, these are 16-bits
Me No Dev
@me-no-dev
Nov 29 2015 16:32
that means you need to call the above for each of those twpo and shift the first answer 4 bits
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:32
great, thanks
Me No Dev
@me-no-dev
Nov 29 2015 16:33
then that result shift another 16
and read the LSB the same way
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:33
so something like (buf[1] << 8) + buf[0]?
Me No Dev
@me-no-dev
Nov 29 2015 16:34
ok again :)
you have 2 8 bit hex numbers
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:34
no
i have two unsigned chars
Me No Dev
@me-no-dev
Nov 29 2015 16:34
that represent 1 16 bit bnumber
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:34
they aren't encoded as hex
i guess you're right, depending on what you mean
i have two bytes, that encode values 0-65536
Me No Dev
@me-no-dev
Nov 29 2015 16:35
x01 x00 => x0100
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:35
yes
exactly
Me No Dev
@me-no-dev
Nov 29 2015 16:36
uint16_t result = (hex_char_to_byte('0') << 12) | (hex_char_to_byte('1') << 8) | (hex_char_to_byte('0') << 4) | hex_char_to_byte('0') ;
oops
there
wrong shifts
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:46
perfect, thank you
Me No Dev
@me-no-dev
Nov 29 2015 16:46
:)
Stavros Korokithakis
@skorokithakis
Nov 29 2015 16:47
worked first try, too
i love it when that happens
Me No Dev
@me-no-dev
Nov 29 2015 16:47
yeah :D not as often as I would like
Markus
@Links2004
Nov 29 2015 17:26
@celsworth @me-no-dev now the changes are on master :)
Chris Elsworth
@celsworth
Nov 29 2015 17:29
thank you, I've yet to try them so now its easier :)
Me No Dev
@me-no-dev
Nov 29 2015 17:36
lets see if pin interrupt issues go down :)
Chris Elsworth
@celsworth
Nov 29 2015 18:14
yes, its fixed it :)
FALLING now works just fine
Me No Dev
@me-no-dev
Nov 29 2015 18:15
great :)
Markus
@Links2004
Nov 29 2015 18:15
@romuye123 may that have also fixed the problem with the dimmer this morning.
Me No Dev
@me-no-dev
Nov 29 2015 18:16
we alredy got that one sorted
in a different way :)
Markus
@Links2004
Nov 29 2015 18:16
ok
where was the problem?
Me No Dev
@me-no-dev
Nov 29 2015 18:17
#include <ESP8266WiFi.h>

const uint8_t AC_pin = 13;  // Output to Opto Triac
const uint8_t ZC_pin = 12;  // Zero Cross Input
const uint8_t freqStep = 75;// 65 for 60Hz
static uint8_t dim    = 0;  // Dimming level (0-128)  0 = on, 128 = 0ff

void triac_on() {
  digitalWrite(AC_pin, HIGH); // turn on light
}

void zero_cross_detect(){
  if(dim > 0){                      // dim is not 0
    digitalWrite(AC_pin, LOW);        // turn off light
    timer1_write(5 * freqStep * dim); // set time to turn on
  } else {                          // dim is 0, menas always ON
    triac_on();                       // turn on light
  }
}

void init_dimmer(){
  pinMode(AC_pin, OUTPUT);
  pinMode(ZC_pin, INPUT);
  attachInterrupt(ZC_pin, zero_cross_detect, RISING);
  timer1_isr_init();
  timer1_attachInterrupt(triac_on);
  timer1_enable(TIM_DIV16, TIM_EDGE, TIM_SINGLE);
}

void set_dimmer(uint8_t value){
  dim = value & 0x7F;
}

void setup(){
  WiFi.mode(WIFI_OFF);
  Serial.begin(115200);
  init_dimmer();
  set_dimmer(58);
}

void loop(){}
Markus
@Links2004
Nov 29 2015 18:21
mm the basics are the same.
only the time where the triac gets the "on" signal is longer.
see currently no reason why it shut not work with timer0.
Me No Dev
@me-no-dev
Nov 29 2015 18:24
what do you mean longer?
the divisor makes 5 ticks per 1 us
that is why I multiply by 5
Markus
@Links2004
Nov 29 2015 18:25
you disable the triac at zero crossing.
the old code only give the signal for 10us hard coded.
Me No Dev
@me-no-dev
Nov 29 2015 18:26
I think he mixed two examples
one with and one without timer
I read the post where he got the isea from and worked from there
Markus
@Links2004
Nov 29 2015 18:27
shut not make a difference, since the triac always disable itself only when zero crossing.
independent from the "on" signal.
Me No Dev
@me-no-dev
Nov 29 2015 18:28
i guess timing was not right with the interrupts and the time the triac is turned on
but he had no scope, logic analizer or another MCU to test that
Markus
@Links2004
Nov 29 2015 18:30
k then its hard to check, as long its working now its ok :)
Me No Dev
@me-no-dev
Nov 29 2015 18:32
yup
onkelfunny
@onkelfunny
Nov 29 2015 20:44
hello
error: no matching function for call to 'ESP8266WebServer::on(const char [8], HTTPMethod, setup()::lambda8, setup()::lambda9)'
or is this a old example?
Me No Dev
@me-no-dev
Nov 29 2015 20:46
it should be working as long as your core is new
onkelfunny
@onkelfunny
Nov 29 2015 20:49
i see there is a newer version available
Mario Mikočević
@mozgy
Nov 29 2015 20:54
I still get Cannot GET /versions/2.0.0-rc2/doc/reference.html
Mario Mikočević
@mozgy
Nov 29 2015 21:06
yeh, I know about .io link but just saying that github Reference.md still has bad link
Markus
@Links2004
Nov 29 2015 21:09
the documents have some problems left, not only the url also the formatting.
@igrr is working on it (https://github.com/esp8266/Arduino/commit/866921c54a889a7cb96cc3c24c304d6809dbb603#commitcomment-14623113).
Stavros Korokithakis
@skorokithakis
Nov 29 2015 22:21
does anyone have any experience with bit-banging IR signals?
Me No Dev
@me-no-dev
Nov 29 2015 22:35
you want to transmit?
Stavros Korokithakis
@skorokithakis
Nov 29 2015 22:43
yep
i analyzed it, looks like the highs are made up of 38.59 khz pulses
so 5.5 usec up, 26 usec down for the highs
all 0 for the lows
hmm, there's a lot of jitter in the analysis
jdcalus
@jdcalus
Nov 29 2015 23:22
Anyone have a pointer to a web page that I can read that shows how to get the USB->Serial interface working on Mac osx El Capitan working? I am trying to flash at EPS8266-01 via the Arduino 1.6.6 IDE