Hi all!
I have an old EC-Block Analog Kit (5+ years old), which I’m going to give to my kid for education. I’ve managed to do all schemes from the paper tutorial, and the missing part are the examples how to use the Leonardo board.
According to the paper tutorial the site used to have a dedicated chapter with samples, but now they are gone (I couldn’t find them even in the web-archive).
Where can I get them?
I guess I can master the board without the dedicated tutorial, but having examples makes this task a lot easier (especially for the kid).
I’ve finally managed to find the page where I can download the archive with samples - https://learn.sunfounder.com/category/ec-block-analog-kitec/
Here are typical implementations of C3Setup()
, readA0()
, readA1()
, writeD9()
and writeD10()
, which are present in each sample:
/**
* @brief C3 port setup, must be called in the function setup().
* @param None
* @retval None
********************************************************/
void C3Setup(void)
{
pinMode(9 , OUTPUT);
pinMode(10, OUTPUT);
}
/**
* @brief Read analog value of A0 port.
* @param None
* @retval Analog value read of A0 port, between 0 to 100.
********************************************************/
byte readA0(void)
{
return (unsigned long)analogRead(A0)*100/1023;
}
/**
* @brief Read analog value of A1 port.
* @param None
* @retval Analog value read of A1 port, between 0 to 100.
********************************************************/
byte readA1(void)
{
return (unsigned long)analogRead(A1)*100/1023;
}
/**
* @brief Write analog value to D9 port.
* @param Analog value write to D9 port, between 0 to 100.
* @retval None
********************************************************/
void writeD9(byte value)
{
if(value>100)
value=100;
analogWrite(9,(unsigned int)value*255/100);
}
/**
* @brief Write analog value to D10 port.
* @param Analog value write to D10 port, between 0 to 100.
* @retval None
********************************************************/
void writeD10(byte value)
{
if(value>100)
value=100;
analogWrite(10,(unsigned int)value*255/100);
}