Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Gabriel Alejandro Giraldo Santiago
Published © GPL3+

Agricultural crop monitoring system with AdaCore

Design and build a system of monitoring and automation of agricultural crops and in the same way study the agroclimatic variables.

IntermediateProtipOver 1 day394

Things used in this project

Story

Read more

Schematics

Prototype

First design of system of monitoring crops

Code

I2C Interfaces

ADA
with Interfaces;

generic
   with procedure Pull_SDA_Down;
   with procedure Release_SDA_Up;
   with procedure Pull_SCL_Down;
   with procedure Release_SCL_Up;
   with procedure Delay_T_HD_STA; -- 4.0
   with procedure Delay_T_SU_STO; -- 4.0
   with procedure Delay_T_Buf; -- 4.7..5
   with procedure Delay_T_Low_Half; -- 2.4
   with procedure Delay_T_High; -- 5
   with function SDA_State return Boolean;
package Soft_I2C is

   type Byte_Array is
     array (Interfaces.Unsigned_8 range <>) of Interfaces.Unsigned_8;

   type Error_Status is
     (SOFT_I2C_OK,
      SOFT_I2C_NACK,
      SOFT_I2C_FAILED);

   procedure Start;
   procedure Stop;
   procedure Write_Byte (Byte : Interfaces.Unsigned_8;
                         Status : out Error_Status);
   procedure Read_Byte (Byte : out Interfaces.Unsigned_8; Ack : Boolean);

   procedure Write (Address : Interfaces.Unsigned_8; Bytes : Byte_Array;
                    Status  : out Error_Status);

   procedure Read (Address : Interfaces.Unsigned_8; Bytes : in out Byte_Array);
end Soft_I2C;

Make File

ADA
test_i2c.elf: soft_i2c.adb uno_i2c.adb soft_i2c.ads
	avr-gnatmake -p -XBOARD=arduino_uno -P i2c

test_i2c.hex: test_i2c.elf
	avr-objcopy -Obinary -R .eeprom test_i2c.elf test_i2c.hex

clean:
	avr-gnatclean -XBOARD=arduino_uno -P i2c

.PHONY: clean

Credits

Gabriel Alejandro Giraldo Santiago
13 projects • 86 followers
Seeed Ranger, AI and Computer Vision expert for key industries. Mentor and speaker on AI, startups, and no-code. Maker enthusiast.
Thanks to Tero Koskinen.

Comments