Material density detection system used to create wet wipes with Arduino 2/2

Imagen
Construction of the final prototype Components used The components used have been, per module: Density Bar 1 - Arduino Pro Mini 5v 4 - LDRs 4 - Resistors 1k 2 - PCB Terminal Blocks Communication bar 1 - Arduino Pro Mini 5v 1 - LM2596s DC-DC step down power supply module 2 - PCB Terminal Blocks 1 - Voltage regulator TIP220 1 - Heat Sink for TIP220 1 - Rectangular LED 6W 630lm 6500K COB 170 x 15 mm. Industruino 1 - Industruino PROTO kit 1 - Relay module Keyes_SR1 Arduino with screen 1 - Arduino UNO R3 1 - 16x2 Character LCD module with I2C 3 - Resistors 10k 2 - Resistors 220 1 - LED Red 1 - LED Green 3 - Buttons 1 - Relay module Keyes_SR1 Assembly of the circuit The Fritzing scheme is as follows: Density bar Circuit that manages the density bar This circuit is responsible for obtaining the measurements and send notifications to the communications bar for redirection. Communication bar Circuit that manages the c

Lectura de ficheros INI sin secciones con Inno Setup desde código

En este post voy a poner un código de ejemplo en el cual se parsea un fichero INI sin secciones (fichero INI estilo UNIX) desde el Inno Setup.
Para esto hay que crear el código en la sección [Code] de este programa.

[Code]
var
    ConfigValues:    TArrayOfString;

function LeeFicheroConfiguracion (FileName: String): Boolean;
begin
    Result := LoadStringsFromFile (FileName, ConfigValues);
end;

function ObtieneValorEtiqueta (Etiqueta: String; var Value: String): Boolean;
var
    I:        LongInt;
    L:        LongInt;
    S:        String;
begin
    S := Etiqueta + '=';
    L := Length (S);
    For I := 0 to GetArrayLength (ConfigValues) - 1 do
    begin
        if (copy (ConfigValues [I], 1, L) = S) then
        begin
            Value := copy (ConfigValues [I], L + 1,
                Length (ConfigValues [I]) - L);
            Result := TRUE;
            Exit;
        end;
    end;
    Result := FALSE;
end;

function EscribeValorEtiqueta (Etiqueta: String; Value: String): Boolean;
var
    I:        LongInt;
    L:        LongInt;
    A:        LongInt;
    S:        String;
begin
    S := Etiqueta + '=';
    L := Length (S);
    A := GetArrayLength (ConfigValues);
    For I := 0 to A - 1 do
    begin
        if (copy (ConfigValues [I], 1, L) = S) then
        begin
            ConfigValues [I] := S + Value;
            Result := TRUE;
            Exit;
        end;
    end;
    SetArrayLength (ConfigValues, A + 1);
    ConfigValues [A] := S + Value;
    Result := FALSE;
end;

function EscribeFicheroConfig (FileName: String): Boolean;
var
    bRet:    Boolean;
begin
    // FileName -> Backup.
    bRet := FileCopy (FileName,
        ExpandConstant ('{tmp}\' + ExtractFileName (FileName)),
        FALSE);
    if (bRet) then
    begin
        bRet := SaveStringsToFile (FileName, ConfigValues, FALSE);
        if (bRet) then
        begin
            Result := TRUE;
            Exit;
        end else
        begin
            // Maybe the backup file should be copied back here?
        end;
    end;
    Result := FALSE;
end;


Espero que le sirva a la gente que haya tenido el mismo problema que yo.


Saludos.

Comentarios

Entradas populares de este blog

Material density detection system used to create wet wipes with Arduino 2/2

Sistema de detección de la densidad del material usado para crear las toallitas húmedas con Arduino 2/2

Sistema de detección de la densidad del material usado para crear las toallitas húmedas con Arduino 1/2