8. Embedded programming

This week I continue with the ATSAMD11C that i already use during the past weeks.

We are in the second week of confinement. I used most of the past days to take care of my company and the employees. My tutor at the Agrilab prepared to me a basic necessities box, so installed my local workshop. 3 chairs 1 for me and 2 for my dog

workshop

Research

i have to read a microcontroller data sheet. 981 pages…

generic AMD11C

and to do something with microcontroller.

I discover Arduino

Arduino language references

Examples

agrilab introduction arduino

the exercise was to use a Arduino to light a led with a button

i use breadboard, mainly because the fab lab is closed.

breadboard1

breadboard2

\

int buttonState = 0;`
`int ledpin = 7;`

`void setup() {`

  `pinMode(ledpin, OUTPUT);`
 `pinMode(buttonPin, INPUT);`

`}`

`void loop() {`

`buttonState = digitalRead(buttonPin);`

  `if (buttonState == HIGH) {`
``    

    digitalWrite(ledpin, HIGH);

  `} el`se {`
``digitalWrite(ledpin, LOW);``

  `}

```

light off of the led with the button

arduino1

arduino2

About the ATSAMD11C

to write the code, you have to compare the physical and logical design. To know which pin to use.

samd11logic

samd11physic

pcb4

in my example, i will use the 2 in output for the led and 15 in input for the button.

intbuttonPin = 15;int buttonState = 0;int ledpin = 2;`

`void setup() {`
  `pinMode(ledpin, OUTPUT);`
 `pinMode(buttonPin, INPUT);`

`}`

`void loop() {`



`buttonState = digitalRead(buttonPin);`

  `if (buttonState == HIGH) {`
`digitalWrite(ledpin, HIGH);} else {digitalWrite(ledpin, LOW);`
  `}`

`}

`

the led light but the button does not work

pcb1

when i use a wire to test, the code work so i think i have to unsolder the button to turn it.

pcb2

when i try to rotate, the trace does not fit with the button so i have to tinker because it’s impossible due to the confinement to mill another board

pcb3

pcb4

pcb5