Now, although there's not many examples for the RMT, and even less using Arduino, I have found THIS example which works for someone to get 3uS pulses . It has ONE line that won't compile for me and editing it out,, it compiles but nothing happens... I am simply wanting to see a pulse or pulses as proof of concept, Any insight into this, would certainly be appreciated...
Code: Select all
// ESP32: Sending short pulses with the RMT
// http://www.buildlog.net/blog/2017/11/esp32-sending-short-pulses-with-the-rmt/
#include "driver/rmt.h"
#define STEP_PIN GPIO_NUM_17
// Reference https://esp-idf.readthedocs.io/en/v1.0/api/rmt.html
rmt_config_t config;
rmt_item32_t items[1];
void setup()
{
config.rmt_mode = RMT_MODE_TX;
config.channel = RMT_CHANNEL_0;
config.gpio_num = STEP_PIN;
config.mem_block_num = 1;
config.tx_config.loop_en = 0;
config.tx_config.carrier_en = 0;
config.tx_config.idle_output_en = 1;
config.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
config.tx_config.carrier_level = RMT_CARRIER_LEVEL_HIGH;
config.clk_div = 80; // 80MHx / 80 = 1MHz 0r 1uS per count
//rmt_config(&config); //<< Line Will not Compile
rmt_driver_install(config.channel, 0, 0); // rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int rmt_intr_num)
items[0].duration0 = 3;
items[0].level0 = 1;
items[0].duration1 = 0;
items[0].level1 = 0;
}
void loop()
{
// esp_err_t rmt_write_items(rmt_channel_t channel, rmt_item32_t *rmt_item, int item_num, bool wait_tx_done)
rmt_write_items(config.channel, items, 1, 0);
delay(1);
}